-
Notifications
You must be signed in to change notification settings - Fork 1
[Class] MultiDatabasePDOStatement
Here is the list of all the functions in the latest version.
WARNING: Some functions might not be available/work differently in older versions.
public function __construct(array $pdoDatabases, string $query)$pdoDatabases
The array of PDO connections for each prepared statement to be run with.
$query
The SQL query
PLEASE NOTE: You won't need to use
new MultiDatabasePDOStatement()in your code, instead can use thepreparemethod in theMultiDatabasePDOclass which will return a new instance of thisMultiDatabasePDOStatementclass.
public function bindValue($nameOrNumber, $value)$nameOrNumber
The name or number of the placeholder (must precede with a colon ':' if using a string placeholder).
$value
The variable or value to pass to the placeholder.
public function bindValues(array $items)$items
The associative array of placeholders and values, for each item in the associative array it will call thebindValuemethod.
public function execute(bool $insertMode = false, string $table = "") : bool$insertMode
Whether or not you are running anINSERTquery. If you're not inserting data don't pass any parameters into this method.
**$table **
If$insertModeis set to true, you will need to supply the name of the table you are inserting data into. Never trust user input as SQL injection can occur here!
Returns true if all the queries to each database table were successful.
public function rowCount() : intReturns the amount of rows there are currently from the prepared statements.
public function getAllRows() : arrayFetches all the current rows.
public function getNextRow() : ?arrayReturns the next row from the prepared statements, if there isn't another row it will return
null.
public function limitTo(int $limit, int $offset = 0)$limit
The amount of rows you want. If you pass in-1then it will return all rows (orPHP_INT_MAX).
$offset
The optional offset, for example passing in2will remove the first two rows.
public function sortBy(string $column, string $direction)$column
The name of the column in your table(s) that you want to sort by.
$direction
The order you want your results (numbers or strings/objects) to be ordered by, must be eitherASCorDESC.