# Query » \PgSQL
Author: Mike van Riel

PostgreSQL specifc class

Extends PDO to simplify cross-database issues

package | Query
subpackage | Drivers

### Methods

## Connect to a PosgreSQL database

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

### Parameters

#### $dsn

`string`

#### $username

`string`

#### $password

`string`

#### $options

`array`

## __sleep()

    __sleep()

Inherited

inherited_from | PDO::__sleep()
inherited_from | \DB_PDO::__sleep()

## __wakeup()

    __wakeup()

Inherited

inherited_from | PDO::__wakeup()
inherited_from | \DB_PDO::__wakeup()

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

    affected_rows(\PDOStatement $statement) : int

Inherited

inherited_from | \DB_PDO::affected_rows()

### Parameters

#### $statement

`\PDOStatement`

### Returns

`int`

## beginTransaction()

    beginTransaction()

Inherited

inherited_from | PDO::beginTransaction()
inherited_from | \DB_PDO::beginTransaction()

## commit()

    commit()

Inherited

inherited_from | PDO::commit()
inherited_from | \DB_PDO::commit()

## Deletes all the rows from a table. Does the same as the truncate method if the database does not support 'TRUNCATE';

    empty_table(string $table) : mixed

Inherited

inherited_from | \DB_PDO::empty_table()

### Parameters

#### $table

`string`

### Returns

`mixed`

## errorCode()

    errorCode()

Inherited

inherited_from | PDO::errorCode()
inherited_from | \DB_PDO::errorCode()

## errorInfo()

    errorInfo()

Inherited

inherited_from | PDO::errorInfo()
inherited_from | \DB_PDO::errorInfo()

## exec()

    exec()

Inherited

inherited_from | PDO::exec()
inherited_from | \DB_PDO::exec()

## getAttribute()

    getAttribute()

Inherited

inherited_from | PDO::getAttribute()
inherited_from | \DB_PDO::getAttribute()

## getAvailableDrivers()

    getAvailableDrivers()

Inherited

inherited_from | PDO::getAvailableDrivers()
inherited_from | \DB_PDO::getAvailableDrivers()

## Return list of dbs for the current connection, if possible

    get_dbs() : array

Inherited

inherited_from | \DB_PDO::get_dbs()

### Returns

`array`

## Return list of function for the current database

    get_functions() : array

Inherited

inherited_from | \DB_PDO::get_functions()

### Returns

`array`

## Return the last error for the current database connection

    get_last_error() : string

Inherited

inherited_from | \DB_PDO::get_last_error()

### Returns

`string`

## Return list of stored procedures for the current database

    get_procedures() : array

Inherited

inherited_from | \DB_PDO::get_procedures()

### Returns

`array`

## Retreives the data from a select query

    get_query_data(\PDOStatement $statement) : array

Inherited

inherited_from | \DB_PDO::get_query_data()

### Parameters

#### $statement

`\PDOStatement`

### Returns

`array`

## Get a list of schemas for the current connection

    get_schemas() : array

### Returns

`array`

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

    get_sequences() : array

Inherited

inherited_from | \DB_PDO::get_sequences()

### Returns

`array`

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

    get_system_tables() : array

Inherited

inherited_from | \DB_PDO::get_system_tables()

### Returns

`array`

## Return list of tables for the current database

    get_tables() : array

Inherited

inherited_from | \DB_PDO::get_tables()

### Returns

`array`

## Return list of triggers for the current database

    get_triggers() : array

Inherited

inherited_from | \DB_PDO::get_triggers()

### Returns

`array`

## Return list of views for the current database

    get_views() : array

Inherited

inherited_from | \DB_PDO::get_views()

### Returns

`array`

## inTransaction()

    inTransaction()

Inherited

inherited_from | PDO::inTransaction()
inherited_from | \DB_PDO::inTransaction()

## lastInsertId()

    lastInsertId()

Inherited

inherited_from | PDO::lastInsertId()
inherited_from | \DB_PDO::lastInsertId()

## Return the number of rows returned for a SELECT query

    num_rows() : int

Inherited

inherited_from | \DB_PDO::num_rows()

### Returns

`int`

## prepare()

    prepare()

Inherited

inherited_from | PDO::prepare()
inherited_from | \DB_PDO::prepare()

## Create and execute a prepared statement with the provided parameters

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

Inherited

inherited_from | \DB_PDO::prepare_execute()

### Parameters

#### $sql

`string`

#### $params

`array`

### Returns

`\PDOStatement`

## Simplifies prepared statements for database queries

    prepare_query(string $sql, array $data) : mixed

Inherited

inherited_from | \DB_PDO::prepare_query()

### Parameters

#### $sql

`string`

#### $data

`array`

### Returns

`mixed`PDOStatement / FALSE

## query()

    query()

Inherited

inherited_from | PDO::query()
inherited_from | \DB_PDO::query()

## quote()

    quote()

Inherited

inherited_from | PDO::quote()
inherited_from | \DB_PDO::quote()

## Surrounds the string with the databases identifier escape characters

    quote_ident(mixed $ident) : string

Inherited

inherited_from | \DB_PDO::quote_ident()

### Parameters

#### $ident

`mixed`

### Returns

`string`

## rollBack()

    rollBack()

Inherited

inherited_from | PDO::rollBack()
inherited_from | \DB_PDO::rollBack()

## setAttribute()

    setAttribute()

Inherited

inherited_from | PDO::setAttribute()
inherited_from | \DB_PDO::setAttribute()

## Connect to a different database

    switch_db(string $name) : void

### Parameters

#### $name

`string`

## Empty a table

    truncate(string $table) : void

### Parameters

#### $table

`string`

## Helper method for quote_ident

    _quote(mixed $str) : mixed

Inherited

inherited_from | \DB_PDO::_quote()

### Parameters

#### $str

`mixed`

### Returns

`mixed`

## Method to simplify retreiving db results for meta-data queries

    driver_query(string $sql, bool $filtered_index) : mixed

Inherited

inherited_from | \DB_PDO::driver_query()

### Parameters

#### $sql

`string`

#### $filtered_index

`bool`

### Returns

`mixed`

### Properties

## Reference to sql sub class

    $sql : Object

Inherited

inherited_from | \DB_PDO::$$sql

## Reference to util sub class

    $util : Object

Inherited

inherited_from | \DB_PDO::$$util

## Character to escape identifiers

    $escape_char : string

Inherited

inherited_from | \DB_PDO::$$escape_char

## Reference to the last executed query

    $statement : mixed

Inherited

inherited_from | \DB_PDO::$$statement