Properties

$statement

$statement : \PDOStatement

Reference to the last executed query

Type

\PDOStatement

$escapeCharOpen

$escapeCharOpen : string

Set the backtick as the MySQL escape character

Type

string

$escapeCharClose

$escapeCharClose : string

Set the backtick as the MySQL escape character

Type

string

$lastQuery

$lastQuery : string

Last query executed

Type

string

$tablePrefix

$tablePrefix : string

Prefix to apply to table names

Type

string

$hasTruncate

$hasTruncate : boolean

Whether the driver supports 'TRUNCATE'

Type

boolean

Methods

__construct()

__construct(string  $dsn, string  $username = NULL, string  $password = NULL, array  $options = array()) 

Connect to MySQL Database

Parameters

string $dsn
string $username
string $password
array $options

__call()

__call(string  $name, array  $args = array()) : mixed

Allow invoke to work on table object

Parameters

string $name
array $args

Returns

mixed

getLastQuery()

getLastQuery() : string

Get the last sql query executed

Returns

string

setLastQuery()

setLastQuery(string  $queryString) : void

Set the last query sql

Parameters

string $queryString

setTablePrefix()

setTablePrefix(string  $prefix) : void

Set the common table name prefix

Parameters

string $prefix

prepareQuery()

prepareQuery(string  $sql, array  $data) : \PDOStatement

Simplifies prepared statements for database queries

Parameters

string $sql
array $data

Throws

\InvalidArgumentException

Returns

\PDOStatement —

| FALSE

prepareExecute()

prepareExecute(string  $sql, array  $params) : \PDOStatement

Create and execute a prepared statement with the provided parameters

Parameters

string $sql
array $params

Returns

\PDOStatement

affectedRows()

affectedRows() : integer

Returns number of rows affected by an INSERT, UPDATE, DELETE type query

Returns

integer

prefixTable()

prefixTable(string  $table) : string

Prefixes a table if it is not already prefixed

Parameters

string $table

Returns

string

quoteTable()

quoteTable(string  $table) : string

Quote database table name, and set prefix

Parameters

string $table

Returns

string

quoteIdent()

quoteIdent(mixed  $identifier) : string

Surrounds the string with the databases identifier escape characters

Parameters

mixed $identifier

Returns

string

getSchemas()

getSchemas() : array

Return schemas for databases that list them

Returns

array

getTables()

getTables() : array

Return list of tables for the current database

Returns

array

getDbs()

getDbs() : array

Return list of dbs for the current connection, if possible

Returns

array

getViews()

getViews() : array

Return list of views for the current database

Returns

array

getSequences()

getSequences() : array

Return list of sequences for the current database, if they exist

Returns

array

getFunctions()

getFunctions() : array

Return list of functions for the current database

Returns

array

getProcedures()

getProcedures() : array

Return list of stored procedures for the current database

Returns

array

getTriggers()

getTriggers() : array

Return list of triggers for the current database

Returns

array

getSystemTables()

getSystemTables() : array

Retrieves an array of non-user-created tables for the connection/database

Returns

array

getColumns()

getColumns(string  $table) : array

Retrieve column information for the current database table

Parameters

string $table

Returns

array

getFks()

getFks(string  $table) : array

Retrieve foreign keys for the table

Parameters

string $table

Returns

array

getIndexes()

getIndexes(string  $table) : array

Retrieve indexes for the table

Parameters

string $table

Returns

array

getTypes()

getTypes() : array

Retrieve list of data types for the database

Returns

array

driverQuery()

driverQuery(string|array|null  $query, boolean  $filteredIndex = TRUE) : array

Method to simplify retrieving db results for meta-data queries

Parameters

string|array|null $query
boolean $filteredIndex

Returns

array

numRows()

numRows() : integer|null

Return the number of rows returned for a SELECT query

Returns

integer|null

insertBatch()

insertBatch(string  $table, array|object  $data = array()) : null|\Query\Drivers\array<string|array|\Query\Drivers\null>

Create sql for batch insert

Parameters

string $table
array|object $data

Returns

null|\Query\Drivers\array

updateBatch()

updateBatch(string  $table, array|object  $data, string  $where) : integer|null

Creates a batch update, and executes it.

Returns the number of affected rows

Parameters

string $table
array|object $data
string $where

Returns

integer|null

_quote()

_quote(mixed  $str) : mixed

Helper method for quote_ident

Parameters

mixed $str

Returns

mixed

truncate()

truncate(string  $table) : \PDOStatement

Empty the passed table

Parameters

string $table

Returns

\PDOStatement

_loadSubClasses()

_loadSubClasses() : void

Loads the subclasses for the driver

_prefix()

_prefix(string  $str) : string

Sets the table prefix on the passed string

Parameters

string $str

Returns

string