Gets the database adapter.

@return AdapterInterface
185965
public function getAdapter()
    {
        if (isset($this->adapter)) {
            return $this->adapter;
        }
        if (isset($this->options['connection'])) {
            if (!($this->options['connection'] instanceof \PDO)) {
                throw new \RuntimeException('The specified connection is not a PDO instance');
            }

            $this->options['connection']->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
            $this->options['adapter'] = $this->options['connection']->getAttribute(\PDO::ATTR_DRIVER_NAME);
        }
        if (!isset($this->options['adapter'])) {
            throw new \RuntimeException('No adapter was specified for environment: ' . $this->getName());
        }

        $factory = AdapterFactory::instance();
        $adapter = $factory
            ->getAdapter($this->options['adapter'], $this->options);

        // Automatically time the executed commands
        $adapter = $factory->getWrapper('timed', $adapter);

        if (isset($this->options['wrapper'])) {
            $adapter = $factory
                ->getWrapper($this->options['wrapper'], $adapter);
        }

        if ($this->getCommand()) {
            $adapter->setCommand($this->getCommand());
        }

        // Use the TablePrefixAdapter if table prefix/suffixes are in use
        if ($adapter->hasOption('table_prefix') || $adapter->hasOption('table_suffix')) {
            $adapter = AdapterFactory::instance()
                ->getWrapper('prefix', $adapter);
        }

        $this->setAdapter($adapter);

        return $adapter;
    }
1220273
private function getAdapterNode()
    {
        $node = $this->createRootNode('adapter');
        return $node
            ->isRequired()
            ->addDefaultsIfNotSet()
            ->children()
                ->enumNode('type')
                    ->values(['jsonapiorg', null])
                ->end()
                ->scalarNode('service')->cannotBeEmpty()->end()
            ->end()
            ->validate()
                ->always(function($v) {
                    $this->validateAdapter($v);
                    return $v;
                })
            ->end()
        ;
    }
107687
public function getAdapter($name = null)
    {
        if (null === $name) {
            $name = $this->getDefaultDatasource();
        }
        if (!isset($this->adapters[$name])) {
            if (!isset($this->adapterClasses[$name])) {
                throw new AdapterException(sprintf('No adapter class defined for datasource "%s"', $name));
            }
            $this->adapters[$name] = AdapterFactory::create($this->adapterClasses[$name]);
        }

        return $this->adapters[$name];
    }
548684
public static function getDatabase()
	{
		//get the database settings from global space
        global $database;

        //create instance of database class
        $instance = new BaseDb($database['default'], $database[$database['default']]);

        //get connection instance and make attempt to connect to the database
        $instance = $instance->initialize()->connect();

		return $instance; 

	}
119789
public function getDbConnection()
  {
    if (is_string($this->db)) {
      $this->db = Yii::$app->get($this->db);
    }
    if (!$this->db instanceof Connection) {
      throw new Exception("The 'db' option must refer to the application component ID of a DB connection.");
    }
    return $this->db;
  }
874086
public function getConnection() {
        if (is_null($this->conn) || !($this->conn)) {
            $dsn = 'dblib:host=' . $this->host . ':1433;dbname=' . $this->db . ';charset=utf8';
            $this->conn = new \PDO($dsn, $this->user, $this->pass);

            if (is_bool($this->conn)) {
                throw new \Exception('unable to connect to db with provided credentials');
            }
        }

        return $this->conn;
    }
438375
public static function getConnection($dsn)
    {
        if (!is_array($dsn)) {
            $dsn = self::parseDsn($dsn);
        }
        if (!isset($dsn['adapter'])) {
            throw new Exception("database adapter is missing for " . json_encode($dsn));
        }
        $class = 'Phalcon\Db\Adapter\Pdo\\' . ucfirst($dsn['adapter']);
        $conn = new $class($dsn);
        return Mixin::create($conn, new self);
    }
89841
public function getDb() {

		if(empty($this->db)) {

			if(empty($this->config->db)) {
				
				try {
					return $this->getVxPDO();
				}
				
				catch(ApplicationException $e) {
					return null;
				}
				
			}

			$config = $this->config->db;

			$this->db = DatabaseInterfaceFactory::create(
				isset($config->type) ? $config->type : 'mysql',
				[
					'host'		=> $config->host,
					'dbname'	=> $config->name,
					'user'		=> $config->user,
					'password'	=> $config->pass,
				]
			);
		}

		return $this->db;

	}
1144111
public function getAuthenticationAdapter()
    {
        if (null === $this->authenticationAdapter) {
            $authenticationAdapter = $this->getAuthenticationService()->getAdapter();
            $this->setAuthenticationAdapter($authenticationAdapter);
        }

        return $this->authenticationAdapter;
    }
171474
protected function getDb()
    {
        if (isset($this->_db)) {
            return $this->_db;
        } else {
            if (($db = Yii::app()->getComponent($this->connectionID)) === null) {
                throw new CException(sprintf(
                    'Failed to get database connection. Component %s not found.',
                    $this->connectionID
                ));
            }
            return $this->_db = $db;
        }
    }
19580
public function getSQLAdapter() {
		return $this->sqlAdapter ? $this->sqlAdapter :
			($this->transactionOperationSet ? $this->transactionOperationSet->getSQLAdapter() : null);
	}
511203
public function getAdapter()
    {
        if (empty($this->adapter)) {
            $user = $this->getUser();
            $sessionDataStored = $user->getAuthSession($this->providerKey);
            $hybridAuth = $this->getHybridAuth();
            if (!empty($sessionDataStored)) {
                $hybridAuth->restoreSessionData($sessionDataStored);
            }
            $adapter = $hybridAuth->authenticate($this->providerKey);
            $sessionData    = $hybridAuth->getSessionData();
            if ($sessionData != $sessionDataStored) {
                $user->updateAuthSession($this->providerKey, $sessionData);
            }
            $this->adapter = $adapter;
        }
        return $this->adapter;
    }
635843
public function getAdapter()
    {
        $className = $this->app->make('config')->get('antares/logger::adapter.default.model');
        return $this->app->make($className);
    }
1093122
public function getTransport()
    {
        $adapter = $this->getAdapter();

        if ($adapter) {
            return $adapter;
        }

        return ucfirst($this->dsn->scheme);
    }
323196
public static function get()
    {

        $database = DatabaseProvider::getDb();
        $r = new \ReflectionMethod(Database::class, 'getConnection');
        $r->setAccessible(true);

        return $r->invoke($database);
    }
339444
public function getAdminAdapter() {
		if ($this->adminAdapter === null) {
			$this->adminAdapter = $this->adapterFactory->createAdminAdapter($this);
		}
		return $this->adminAdapter;
	}
768795
public function getDatabase()
    {
        if(!isset($this->_database))
        {
            $query = $this->getObject('lib:database.query.select')
                ->columns('DATABASE()');

            $this->_database = $this->select($query, KDatabase::FETCH_FIELD);
        }
        return $this->_database;
    }