# \Query\DriversDriverInterface

PDO Interface to implement for database drivers

## Summary

Methods
Constants
__construct()
beginTransaction()
commit()
errorCode()
errorInfo()
exec()
getAttribute()
getAvailableDrivers()
inTransaction()
lastInsertId()
prepare()
query()
quote()
rollBack()
setAttribute()
prepareQuery()
getColumns()
getTypes()
getIndexes()
getFks()
getTables()
getSystemTables()
getDbs()
getViews()
getSequences()
getFunctions()
getProcedures()
getTriggers()
quoteIdent()
quoteTable()
prepareExecute()
driverQuery()
affectedRows()
numRows()
prefixTable()
insertBatch()
updateBatch()
getSql()
getUtil()
setLastQuery()
No constants found
No protected methods found
N/A
No private methods found
N/A

File
  Query/Drivers/DriverInterface.php
Package
  \Default
Parents
  \Query\Drivers\PDOInterface

## Tags

None found

## Methods

### __construct()

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

Constructor/Connection method

#### Parameters

string | $dsn |
string | $username |
string | $password |
array | $driverOptions |

#

## Tags

None found

### beginTransaction()

    beginTransaction() : boolean

Initiates a transaction

#### Throws

\PDOException

#### Returns

boolean

#

Inherited from
  \Query\Drivers\PDOInterface

## Tags

None found

### commit()

    commit() : boolean

Commits a transaction

#### Throws

\PDOException

#### Returns

boolean

#

Inherited from
  \Query\Drivers\PDOInterface

## Tags

None found

### errorCode()

    errorCode() : mixed

Fetch the SQLSTATE associated with the last operation on the database handle

#### Returns

mixed

#

Inherited from
  \Query\Drivers\PDOInterface

## Tags

None found

### errorInfo()

    errorInfo() : array

Fetch extended error information associated with the last operation on the database handle

#### Returns

array

#

Inherited from
  \Query\Drivers\PDOInterface

## Tags

None found

### exec()

    exec(string  $statement) : integer

Execute an SQL statement and return the number of affected rows

#### Parameters

string | $statement |

#### Returns

integer

#

Inherited from
  \Query\Drivers\PDOInterface

## Tags

None found

### getAttribute()

    getAttribute(integer  $attribute) : mixed

Retrieve a database connection attribute

#### Parameters

integer | $attribute |

#### Returns

mixed

#

Inherited from
  \Query\Drivers\PDOInterface

## Tags

None found

### getAvailableDrivers()

    getAvailableDrivers() : array

Return an array of available PDO drivers

#### Returns

array

#

static

Inherited from
  \Query\Drivers\PDOInterface

## Tags

None found

### inTransaction()

    inTransaction() : boolean

Checks if inside a transaction

#### Returns

boolean

#

Inherited from
  \Query\Drivers\PDOInterface

## Tags

None found

### lastInsertId()

    lastInsertId(string  $name = NULL) : string

Returns teh ID of the last inserted row or sequence value

#### Parameters

string | $name | Name of the sequence object from which the ID should be returned

#### Returns

string

#

Inherited from
  \Query\Drivers\PDOInterface

## Tags

None found

### prepare()

    prepare(string  $statement, array  $options = NULL) : \PDOStatement

Prepares a statement for execution and returns a statement object

#### Parameters

string | $statement |
array | $options |

#### Returns

\PDOStatement

#

Inherited from
  \Query\Drivers\PDOInterface

## Tags

None found

### query()

    query() : \PDOStatement

Executes an SQL statement, returning a result set as a PDOStatement object

#### Returns

\PDOStatement

#

Inherited from
  \Query\Drivers\PDOInterface

## Tags

None found

### quote()

    quote(string  $string, integer  $parameterType = \PDO::PARAM_STR) : string|false

Quotes a string for use in a query

#### Parameters

string | $string |
integer | $parameterType |

#### Returns

string|false

#

Inherited from
  \Query\Drivers\PDOInterface

## Tags

None found

### rollBack()

    rollBack() : boolean

Rolls back a transaction

#### Throws

\PDOException

#### Returns

boolean

#

Inherited from
  \Query\Drivers\PDOInterface

## Tags

None found

### setAttribute()

    setAttribute(integer  $attribute, mixed  $value) : boolean

Set an attribute

#### Parameters

integer | $attribute |
mixed | $value |

#### Returns

boolean

#

Inherited from
  \Query\Drivers\PDOInterface

## Tags

None found

### prepareQuery()

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

Simplifies prepared statements for database queries

#### Parameters

string | $sql |
array | $data |

#### Throws

\InvalidArgumentException

#### Returns

\PDOStatement —

| FALSE

#

## Tags

None found

### getColumns()

    getColumns(string  $table) : array

Retrieve column information for the current database table

#### Parameters

string | $table |

#### Returns

array

#

## Tags

None found

### getTypes()

    getTypes() : array

Retrieve list of data types for the database

#### Returns

array

#

## Tags

None found

### getIndexes()

    getIndexes(string  $table) : array

Retrieve indexes for the table

#### Parameters

string | $table |

#### Returns

array

#

## Tags

None found

### getFks()

    getFks(string  $table) : array

Retrieve foreign keys for the table

#### Parameters

string | $table |

#### Returns

array

#

## Tags

None found

### getTables()

    getTables() : array

Return list of tables for the current database

#### Returns

array

#

## Tags

None found

### getSystemTables()

    getSystemTables() : array

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

#### Returns

array

#

## Tags

None found

### getDbs()

    getDbs() : array

Return list of dbs for the current connection, if possible

#### Returns

array

#

## Tags

None found

### getViews()

    getViews() : array

Return list of views for the current database

#### Returns

array

#

## Tags

None found

### getSequences()

    getSequences() : array

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

#### Returns

array

#

## Tags

None found

### getFunctions()

    getFunctions() : array

Return list of functions for the current database

#### Returns

array

#

## Tags

None found

### getProcedures()

    getProcedures() : array

Return list of stored procedures for the current database

#### Returns

array

#

## Tags

None found

### getTriggers()

    getTriggers() : array

Return list of triggers for the current database

#### Returns

array

#

## Tags

None found

### quoteIdent()

    quoteIdent(string|array  $ident) : string|array

Surrounds the string with the databases identifier escape characters

#### Parameters

string|array | $ident |

#### Returns

string|array

#

## Tags

None found

### quoteTable()

    quoteTable(string|array  $table) : string|array

Quote database table name, and set prefix

#### Parameters

string|array | $table |

#### Returns

string|array

#

## Tags

None found

### prepareExecute()

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

Create and execute a prepared statement with the provided parameters

#### Parameters

string | $sql |
array | $params |

#### Returns

\PDOStatement

#

## Tags

None found

### 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

#

## Tags

None found

### affectedRows()

    affectedRows() : integer

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

#### Returns

integer

#

## Tags

None found

### numRows()

    numRows() : integer

Return the number of rows returned for a SELECT query

#### Returns

integer

#

See also
  http://us3.php.net/manual/en/pdostatement.rowcount.php#87110

## Tags

None found

### prefixTable()

    prefixTable(string  $table) : string

Prefixes a table if it is not already prefixed

#### Parameters

string | $table |

#### Returns

string

#

## Tags

None found

### insertBatch()

    insertBatch(string  $table, array  $data = array()) : array

Create sql for batch insert

#### Parameters

string | $table |
array | $data |

#### Returns

array

#

## Tags

None found

### 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

#

## Tags

None found

### getSql()

    getSql() : \Query\Drivers\SQLInterface

Get the SQL class for the current driver

#### Returns

\Query\Drivers\SQLInterface

#

## Tags

None found

### getUtil()

    getUtil() : \Query\Drivers\AbstractUtil

Get the Util class for the current driver

#### Returns

\Query\Drivers\AbstractUtil

#

## Tags

None found

### setLastQuery()

    setLastQuery(string  $queryString) : void

Set the last query sql

#### Parameters

string | $queryString |

#

## Tags

None found

### DriverInterface.php