# \QueryDriver_Interface

PDO Interface to implement for database drivers

## Summary

Methods
Constants
__construct()
prepare_query()
beginTransaction()
commit()
errorCode()
errorInfo()
exec()
getAttribute()
rollback()
setAttribute()
get_columns()
get_types()
get_indexes()
get_fks()
get_tables()
get_system_tables()
get_dbs()
get_views()
get_sequences()
get_functions()
get_procedures()
get_triggers()
quote_ident()
quote_table()
prepare_execute()
get_sql()
get_util()
driver_query()
affected_rows()
num_rows()
prefix_table()
insert_batch()
No constants found
No protected methods found
N/A
No private methods found
N/A

File
  src/Query/Driver_Interface.php
Package
  \Query\Drivers

## Tags

None found

## Methods

### __construct()

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

Constructor/Connection method

#### Parameters

string | $dsn |
string | $username |
string | $password |
array | $driver_options |

#

## Tags

None found

### prepare_query()

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

Simplifies prepared statements for database queries

#### Parameters

string | $sql |
array | $data |

#### Throws

\InvalidArgumentException

#### Returns

\PDOStatement —

| FALSE

#

## Tags

None found

### beginTransaction()

    beginTransaction() : boolean

Begin a transaction

#### Returns

boolean

#

## Tags

None found

### commit()

    commit() : boolean

Commit a transaction

#### Returns

boolean

#

## Tags

None found

### errorCode()

    errorCode() : mixed

Return the current error code

#### Returns

mixed

#

## Tags

None found

### errorInfo()

    errorInfo() : array

Return information about the current error

#### Returns

array

#

## Tags

None found

### exec()

    exec(string  $statement) : integer

Execute an SQL statement and return the number of affected rows

#### Parameters

string | $statement |

#### Returns

integer

#

## Tags

None found

### getAttribute()

    getAttribute(integer  $attribute) : mixed

Get a connection attribute for the current db driver

#### Parameters

integer | $attribute |

#### Returns

mixed

#

## Tags

None found

### rollback()

    rollback() : boolean

Rollback a transaction

#### Returns

boolean

#

## Tags

None found

### setAttribute()

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

Set a connection attribute

#### Parameters

integer | $attribute |
mixed | $value |

#### Returns

boolean

#

## Tags

None found

### get_columns()

    get_columns(string  $table) : array

Retrieve column information for the current database table

#### Parameters

string | $table |

#### Returns

array

#

## Tags

None found

### get_types()

    get_types() : array

Retrieve list of data types for the database

#### Returns

array

#

## Tags

None found

### get_indexes()

    get_indexes(string  $table) : array

Retrieve indexes for the table

#### Parameters

string | $table |

#### Returns

array

#

## Tags

None found

### get_fks()

    get_fks(string  $table) : array

Retrieve foreign keys for the table

#### Parameters

string | $table |

#### Returns

array

#

## Tags

None found

### get_tables()

    get_tables() : array

Return list of tables for the current database

#### Returns

array

#

## Tags

None found

### get_system_tables()

    get_system_tables() : array

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

#### Returns

array

#

## Tags

None found

### get_dbs()

    get_dbs() : array

Return list of dbs for the current connection, if possible

#### Returns

array

#

## Tags

None found

### get_views()

    get_views() : array

Return list of views for the current database

#### Returns

array

#

## Tags

None found

### get_sequences()

    get_sequences() : array

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

#### Returns

array

#

## Tags

None found

### get_functions()

    get_functions() : array

Return list of functions for the current database

#### Returns

array

#

## Tags

None found

### get_procedures()

    get_procedures() : array

Return list of stored procedures for the current database

#### Returns

array

#

## Tags

None found

### get_triggers()

    get_triggers() : array

Return list of triggers for the current database

#### Returns

array

#

## Tags

None found

### quote_ident()

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

Surrounds the string with the databases identifier escape characters

#### Parameters

string|array | $ident |

#### Returns

string|array

#

## Tags

None found

### quote_table()

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

Quote database table name, and set prefix

#### Parameters

string|array | $table |

#### Returns

string|array

#

## Tags

None found

### prepare_execute()

    prepare_execute(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

### get_sql()

    get_sql() : \Query\SQL_Interface

Get the SQL class for the current driver

#### Returns

\Query\SQL_Interface

#

## Tags

None found

### get_util()

    get_util() : \Query\Abstract_Util

Get the Util class for the current driver

#### Returns

\Query\Abstract_Util

#

## Tags

None found

### driver_query()

    driver_query(string|array|null  $query, boolean  $filtered_index = TRUE) : array

Method to simplify retrieving db results for meta-data queries

#### Parameters

string|array|null | $query |
boolean | $filtered_index |

#### Returns

array

#

## Tags

None found

### affected_rows()

    affected_rows() : integer

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

#### Returns

integer

#

## Tags

None found

### num_rows()

    num_rows() : integer

Return the number of rows returned for a SELECT query

#### Returns

integer

#

See also

## Tags

None found

### prefix_table()

    prefix_table(string  $table) : string

Prefixes a table if it is not already prefixed

#### Parameters

string | $table |

#### Returns

string

#

## Tags

None found

### insert_batch()

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

Create sql for batch insert

#### Parameters

string | $table |
array | $data |

#### Returns

array

#

## Tags

None found

### Driver_Interface.php