[Class] MultiDatabasePDO - WulfGamesYT/MultiDatabasePDO GitHub Wiki

Here is the list of all the functions in the latest version. WARNING: Some functions might not be available/work differently in older versions.

Constructor

public function __construct(array $connectionParamsList)

$connectionParamsListAn associative array of databases to initially connect to, you must supply a DSN, username and password inside each array item in the associative array itself.

Function: hasAnyErrors

public function hasAnyErrors() : bool

Returns true if there were any errors connecting to all the databases initially.

Function: getFailedConnections

public function getFailedConnections() : string

Returns a string containing the list of databases that couldn't connect, this should never be printed out to a page - instead, it should be put in a private error log file.

Function: prepare

public function prepare(string $query) : MultiDatabasePDOStatement

$queryThe SQL query string to prepare, this can contain placeholders like ':firstname'.

Returns a new instance of a MultiDatabasePDOStatement where you can then bind values, execute and sort/limit the results and query to all databases.

Function: addPDOAttribute

public function addPDOAttribute(int $attribute, $value)

$attributeThe PDO attribute, can be any attribute from here.

$valueThe PDO attribute value, can be any value from here.

Function: addPDOAttributes

public function addPDOAttributes(array $items)

$itemsThe associative array of attributes and values, for each item in the associative array it will call the addPDOAttribute method.

Function: generateMDGUID

public function generateMDGUID() : string

Generates a new, truly unique MDGUID and inserts it into the queue table. Returns the MDGUID as a string.

Function: finishAndClose

public function finishAndClose()

Will close all connections, delete all statements and every returned row.