Close one or all (if no parameter passed) registered datasource connections
@param  string $name The datasource name, omit for close all of them
@return bool       `true` if one or more datasource where closed
974180
public static function close($name=null){
    if ($name === null) {
      foreach (self::$connections as $conn) $conn->close();
      return true;
    } else if (isset(self::$connections[$name])){
      self::$connections[$name]->close();
      return true;
    } else return false;
  }
1344496
static public function connection($name = null)
    {
        if ($name === null) {
            $name = self::$activeConnectionName;
            
            if (!$name) {
                if (self::$defaultConnectionName) {
                    $name = self::$defaultConnectionName;
                    self::setConnection($name);
                    self::$defaultConnectionName = null;
                } else {
                    throw new Exception\RuntimeException("No database connection is active");
                }
            }
        } else {
            self::create_connection($name);
        }
        
        return self::$_connections[$name];
    }
417987
public function isLocked($name)
    {
        if ($this->acquireLock($name, false)) {
            return !$this->releaseLock($name);
        }

        return true;
    }
772103
public static function connection($name = null)
    {
        self::$use = $name ? $name : self::$use;
        return self::get(self::$use);
    }
525472
function _close()
	{
		if ($this->_connectionID) $this->_connectionID->Close();
		$this->_connectionID = false;
		return true;
	}
823458
public function disconnect(string $name = null)
    {
        $name = $name ?: $this->getDefaultConnection();

        unset($this->connections[$name]);
    }
234833
public function clearLock($name)
    {
        if (!isset($this->locks[$name])) {
            return false;
        }

        unset($this->locks[$name]);
        return true;
    }
492117
public function connection($name = null)
    {
        $name = $name ?: 'default';

        if (isset($this->connections[$name])) {
            return $this->connections[$name];
        }

        return $this->connections[$name] = $this->configure(
            $this->resolve($name), $name
        );
    }
745567
public function connection($name = 'default')
    {
        if ( ! isset($this) ) return self::getInstance()->clients[Config::get("redis.$name")];
        return $this->clients[ Config::get("redis.$name") ];
    }
293972
public function connection($name = null)
    {
        if (is_null($name)) {
            $name = $this->getDefaultConnection();
        }

        if (! isset($this->connections[$name])) {
            throw new InvalidArgumentException("Connection [{$name}] is not registered.");
        }

        return $this->connections[$name];
    }
1008841
public function hasSingleResult($name) {
        $parts = explode(".", $name);
        $nameSoFar = "";
        foreach ($parts as $part) {
            $lastNameSoFar = $nameSoFar;
            $nameSoFar .= ($nameSoFar ? '.' : '') . $part;
            if (!isset($this->relations[$nameSoFar])) {
                $this->relations[$nameSoFar] = $this->initSubRelation($nameSoFar, $this->relations[$lastNameSoFar]);
            }
            if (!$this->relations[$nameSoFar]->hasSingleResult()) {
                if (!isset($this->toBeSelectedSeparately[$nameSoFar])) {
                    $this->toBeSelectedSeparately[$nameSoFar] = [
                        'relation' => $this->relations[$nameSoFar],
                        'subrelations' => []
                    ];
                }
                if ($nameSoFar != $name) {
                    $this->toBeSelectedSeparately[$nameSoFar]['subrelations'][] = substr($name, strlen($nameSoFar) + 1); // also keep name for separate select
                }
                return false;
            }
        }
        return true;
    }
760940
public function removeConnection($name)
    {
        if (!$this->hasConnection($name)) {
            throw new \InvalidArgumentException(sprintf('The connection "%s" does not exists.', $name));
        }

        unset($this->connections[$name]);
    }
820292
public function remove($name)
    {
        if(array_key_exists($name, $this->data))
        {
            unset($this->data[$name]);
            return true;
        }
        else
        {
            return false;
        }
    }
124922
public function hasDatabase($name)
    {
        foreach ($this->dbList as $db) {
            if ($db->getName() === $name) {
                return true;
            }
        }

        return false;
    }
265292
public function deleteIndex($name)
    {
        $client = $this->getClient();

        $index = $client->getIndex($name);
        $index->close();
        $index->delete();
    }
811359
public function removeProvider($name)
    {
        if ($this->hasProvider($name)) {
            unset($this->providers[$name]);

            return true;
        }

        return false;
    }
987915
public function deleteTable($name)
    {
        try {
            $this->_tableProxy->deleteTable($name);

            return true;
        } catch (\Exception $ex) {
            return false;
        }
    }