メインコンテンツまでスキップ
Version: Fegg 5.x(開発版)

Pdo::slaveServer

Connect to slave server

Description​

public self Pdo::slaveServer()

Connects to one of the slave databases, picked at random (see Configuration), and runs the next query on it. SELECT and PRAGMA queries already use a slave; this sends another query there. Throws Fegg\Database\QueryException when the connection fails.

Example​

Controller
$db = new \Fegg\Database\Pdo();

// Same as without slaveServer(): a SELECT already uses a slave
$rows = $db->slaveServer()->select('cms_news')->execute()->all();