프로퍼티 | 타입 | 설명 | |
---|---|---|---|
$LOG_ERRORS | boolean | Write all errors to error log | |
$TIMESTAMP_WRITES | boolean | Automatically add/update created/updated fields |
프로퍼티 | 타입 | 설명 | |
---|---|---|---|
$config_master | Dynamic master config creds | ||
$config_slaves | Dynamic slave config creds | ||
$instance | PDOWrapper | A reference to the singleton instance | |
$pdo_exception | We will cache any PDO errors in case we want to get out them externally | ||
$pdo_master | The PDO objects for the master connection | ||
$pdo_slave | The PDO objects for the slave connection |
메소드 | 설명 | |
---|---|---|
__destruct ( ) | Destructor. | |
configMaster ( $host, $name, $user, $password, $port = null, $driver = 'mysql' ) | method configMaster - configure connection credentials to the master db server | |
configSlave ( $host, $name, $user, $password, $port = null, $driver = 'mysql' ) | method configSlave - configure a connection to a slave (can be called multiple times) | |
delete ( $table, $params = [] ) : boolean | method delete. | |
execute ( string $query, $params = [] ) : mixed | method execute. | |
getErrorMessage ( ) | method getErrorMessage. | |
getPDOException ( ) | method getError. | |
insert ( string $table, array $params = [], boolean $timestamp_this = null ) : mixed | method insert. | |
insertMultiple ( string $table, array $columns = [], $rows = [], boolean $timestamp_these = null ) : mixed | method insertMultiple. | |
instance ( ) : - | method instance. | |
query ( string $query, array $params = [], boolean $use_master = false ) : mixed | method query. | |
queryFirst ( string $query, array $params = [], boolean $use_master = false ) : mixed | method queryFirst. | |
select ( string $table, array $params = null, integer $limit = null, integer $start = null, array $order_by = null, boolean $use_master = false ) : mixed | method select. | |
selectFirst ( $table, $params = [], array $order_by = null ) : mixed | method selectFirst. | |
selectFirstMaster ( $table, $params = [], array $order_by = null ) : mixed | method selectFirstMaster. | |
selectMaster ( $table, $params = [], integer $limit = null, integer $start = null, array $order_by = null ) : mixed | method selectMaster. | |
update ( string $table, array $params, array $wheres = [], boolean $timestamp_this = null ) : integer | boolean | method update. |
메소드 | 설명 | |
---|---|---|
__construct ( ) | Constructor. | |
createConnection ( $driver, $host, $name, $user, $password, $port = null ) : PDO | method createConnection. | |
getMaster ( ) | method getMaster. | |
getSlave ( ) | method getSlave. |
메소드 | 설명 | |
---|---|---|
validateDriver ( string $driver ) : boolean | Validate the database in question is supported by your installation of PHP. |
protected __construct ( ) |
public configMaster ( $host, $name, $user, $password, $port = null, $driver = 'mysql' ) |
public configSlave ( $host, $name, $user, $password, $port = null, $driver = 'mysql' ) |
protected createConnection ( $driver, $host, $name, $user, $password, $port = null ) : PDO | ||
리턴 | PDO | object with a connection to the database specified |
protected getSlave ( ) |
public insert ( string $table, array $params = [], boolean $timestamp_this = null ) : mixed | ||
$table | string | - the name of the db table we are adding row to |
$params | array | - associative array representing the columns and their respective values |
$timestamp_this | boolean | (Optional), if true we set date_created and date_modified values to now |
리턴 | mixed | - new primary key of inserted table, false on failure |
public insertMultiple ( string $table, array $columns = [], $rows = [], boolean $timestamp_these = null ) : mixed | ||
$table | string | - the name of the db table we are adding row to |
$columns | array | - contains the column names |
$timestamp_these | boolean | (Optional), if true we set date_created and date_modified values to NOW() for each row |
리턴 | mixed | - new primary key of inserted table, false on failure |
public static instance ( ) : - | ||
리턴 | - |
public query ( string $query, array $params = [], boolean $use_master = false ) : mixed | ||
$query | string | - the SQL query we are executing |
$params | array | - a list of bind parameters |
$use_master | boolean | (Optional) - whether or not to use the master connection |
리턴 | mixed | - the affected rows, false on failure |
public queryFirst ( string $query, array $params = [], boolean $use_master = false ) : mixed | ||
$query | string | - the SQL query we are executing |
$params | array | - a list of bind parameters |
$use_master | boolean | (Optional) - whether or not to use the master connection |
리턴 | mixed | - the affected rows, false on failure |
public select ( string $table, array $params = null, integer $limit = null, integer $start = null, array $order_by = null, boolean $use_master = false ) : mixed | ||
$table | string | - the name of the db table we are retreiving the rows from |
$params | array | - associative array representing the WHERE clause filters |
$limit | integer | (optional) - the amount of rows to return |
$start | integer | (optional) - the row to start on, indexed by zero |
$order_by | array | (optional) - an array with order by clause |
$use_master | boolean | (optional) - use the master db for this read |
리턴 | mixed | - associate representing the fetched table row, false on failure |
public selectFirst ( $table, $params = [], array $order_by = null ) : mixed | ||
$order_by | array | (optional) - an array with order by clause |
리턴 | mixed | - associate representing the fetched table row, false on failure |
public selectFirstMaster ( $table, $params = [], array $order_by = null ) : mixed | ||
$order_by | array | (optional) - an array with order by clause |
리턴 | mixed | - associate representing the fetched table row, false on failure |
public selectMaster ( $table, $params = [], integer $limit = null, integer $start = null, array $order_by = null ) : mixed | ||
$limit | integer | (optional) - the amount of rows to return |
$start | integer | (optional) - the row to start on, indexed by zero |
$order_by | array | (optional) - an array with order by clause |
리턴 | mixed | - associate representing the fetched table row, false on failure |
public update ( string $table, array $params, array $wheres = [], boolean $timestamp_this = null ) : integer | boolean | ||
$table | string | - the name of the db table we are adding row to |
$params | array | - associative array representing the columns and their respective values to update |
$wheres | array | (Optional) - the where clause of the query |
$timestamp_this | boolean | (Optional) - if true we set date_created and date_modified values to now |
리턴 | integer | boolean | - the amount of rows updated, false on failure |
public static bool $TIMESTAMP_WRITES | ||
리턴 | boolean |
protected static PDOWrapper $instance | ||
리턴 | PDOWrapper |
protected $pdo_exception |