db\Connection openFromPool()

openFromPool() protected method Opens the connection to a server in the pool. This method implements the load balancing among the given list of the servers. protected yii\db\Connection openFromPool ( array $pool, array $sharedConfig )$pool array The list of connection configurations in the server pool $sharedConfig array The configuration common to those given in $pool. return yii\db\Connection The opened DB connection, or null if no server is available throws yii\base\InvalidConfig

db\Connection open()

open() public method Establishes a DB connection. It does nothing if a DB connection has already been established. public void open ( )throws yii\db\Exception if connection fails

db\Connection noCache()

noCache() public method Disables query cache temporarily. Queries performed within the callable will not use query cache at all. For example, $db->cache(function (Connection $db) { // ... queries that use query cache ... return $db->noCache(function (Connection $db) { // this query will not use query cache return $db->createCommand('SELECT * FROM customer WHERE id=1')->queryOne(); }); }); See also: $enableQueryCache $queryCache cache() public mix

db\Connection initConnection()

initConnection() protected method Initializes the DB connection. This method is invoked right after the DB connection is established. The default implementation turns on PDO::ATTR_EMULATE_PREPARES if $emulatePrepare is true, and sets the database $charset if it is not empty. It then triggers an EVENT_AFTER_OPEN event. protected void initConnection ( )

db\Connection getTransaction()

getTransaction() public method Returns the currently active transaction. public yii\db\Transaction getTransaction ( )return yii\db\Transaction The currently active transaction. Null if no active transaction.

db\Connection getTableSchema()

getTableSchema() public method Obtains the schema information for the named table. public yii\db\TableSchema getTableSchema ( $name, $refresh = false )$name string Table name. $refresh boolean Whether to reload the table schema even if it is found in the cache. return yii\db\TableSchema Table schema information. Null if the named table does not exist.

db\Connection getSlavePdo()

getSlavePdo() public method Returns the PDO instance for the currently active slave connection. When $enableSlaves is true, one of the slaves will be used for read queries, and its PDO instance will be returned by this method. public PDO getSlavePdo ( $fallbackToMaster = true )$fallbackToMaster boolean Whether to return a master PDO in case none of the slave connections is available. return PDO The PDO instance for the currently active slave connection. Null is returned if no slave con

db\Connection getSlave()

getSlave() public method Returns the currently active slave connection. If this method is called the first time, it will try to open a slave connection when $enableSlaves is true. public yii\db\Connection getSlave ( $fallbackToMaster = true )$fallbackToMaster boolean Whether to return a master connection in case there is no slave connection available. return yii\db\Connection The currently active slave connection. Null is returned if there is slave available and $fallbackToMaster is fa

db\Connection getSchema()

getSchema() public method Returns the schema information for the database opened by this connection. public yii\db\Schema getSchema ( )return yii\db\Schema The schema information for the database opened by this connection. throws yii\base\NotSupportedException if there is no support for the current driver type

db\Connection getQueryCacheInfo()

getQueryCacheInfo() public method Returns the current query cache information. This method is used internally by yii\db\Command. public array getQueryCacheInfo ( $duration, $dependency )$duration integer The preferred caching duration. If null, it will be ignored. $dependency yii\caching\Dependency The preferred caching dependency. If null, it will be ignored. return array The current query cache information, or null if query cache is not enabled.