Public Member Functions | |
__construct (Closure $pdoLoader) | |
execute (string $query, array $data=[]) | |
fetch () | |
lastError () | |
Protected Member Functions | |
setError (string $query="", array $errInfo=[]) | |
getPdo () | |
Protected Attributes | |
$delim = "\"" | |
$pdo = null | |
$pdoLoader = null | |
$stmnt = null | |
$error = null | |
Additional Inherited Members | |
![]() | |
const | DB_CUBRID = "cubrid" |
const | DB_DBLIB = "dblib" |
const | DB_FIREBIRD = "firebird" |
const | DB_IBM = "ibm" |
const | DB_INFORMIX = "informix" |
const | DB_MYSQL = "mysql" |
const | DB_OCI = "oci" |
const | DB_ODBC = "odbc" |
const | DB_PGSQL = "pgsql" |
const | DB_SQLITE = "sqlite" |
const | DB_SQLSRV = "sqlsrv" |
const | DB_4D = "4d" |
SlaxWeb\DatabasePDO\Library::__construct | ( | Closure | $pdoLoader | ) |
Class constrcutor
Initiates the class and assigns the dependencies to local properties for later use.
\Closure | $pdoLoader | PDO lazy load Closure |
SlaxWeb\DatabasePDO\Library::execute | ( | string | $query, |
array | $data = [] |
||
) |
Execute Query
Executes the received query and binds the received parameters into the query to decrease the chance of an SQL injection. Returns bool(true) if query was successfuly executed, and bool(false) if it was not. If the query yielded a result set, a Result object will be populated.
string | $query | The Query to be executed |
array | $data | Data to be bound into the Query, default [] |
Implements SlaxWeb\Database\Interfaces\Library.
SlaxWeb\DatabasePDO\Library::fetch | ( | ) |
Fetch Results
It fetches the results from the last executed statement, creates the Result object and returns it. If an statement has not yet been executed or did not yield a valid result set, an exception is thrown.
Implements SlaxWeb\Database\Interfaces\Library.
|
protected |
Get PDO
Gets the PDO from the closure or from the internal property.
SlaxWeb\DatabasePDO\Library::lastError | ( | ) |
Get last error
Retrieves the error of the last executed query. If there was no error, an exception must be thrown.
Implements SlaxWeb\Database\Interfaces\Library.
|
protected |
Set error
Sets the error based on PDOs error info.
string | $query | Query that caused the error. Default "" |
array | $errInfo | Error info array, if left empty PDO Error Info array is obtained |