# \Query\Drivers\PgsqlDriver

PostgreSQL specific class

Extends PDO to simplify cross-database issues

## Summary

Methods
Properties
Constants
__construct()
__call()
getLastQuery()
setLastQuery()
getSql()
getUtil()
setTablePrefix()
prepareQuery()
prepareExecute()
affectedRows()
prefixTable()
quoteTable()
quoteIdent()
getSchemas()
getTables()
getDbs()
getViews()
getSequences()
getFunctions()
getProcedures()
getTriggers()
getSystemTables()
getColumns()
getFks()
getIndexes()
getTypes()
driverQuery()
numRows()
insertBatch()
updateBatch()
_quote()
truncate()
No public properties found
No constants found
_loadSubClasses()
_prefix()
$statement
$escapeCharOpen
$escapeCharClose
$sql
$util
$lastQuery
$tablePrefix
$hasTruncate
N/A
No private methods found
No private properties found
N/A

File
  Query/Drivers/Pgsql/Driver.php
Package
  Default
Class hierarchy
  \PDO
  \Query\Drivers\AbstractDriver
  \Query\Drivers\Pgsql\Driver
Implements
  \Query\Drivers\DriverInterface

## Tags

None found

## Properties

### $statement

    $statement : \PDOStatement

Reference to the last executed query

#### Type

\PDOStatement

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### $escapeCharOpen

    $escapeCharOpen : string

Start character to escape identifiers

#### Type

string

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### $escapeCharClose

    $escapeCharClose : string

End character to escape identifiers

#### Type

string

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### $sql

    $sql : \Query\Drivers\SQLInterface

Reference to sql class

#### Type

\Query\Drivers\SQLInterface

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### $util

    $util : \Query\Drivers\AbstractUtil

Reference to util class

#### Type

\Query\Drivers\AbstractUtil

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### $lastQuery

    $lastQuery : string

Last query executed

#### Type

string

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### $tablePrefix

    $tablePrefix : string

Prefix to apply to table names

#### Type

string

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### $hasTruncate

    $hasTruncate : boolean

Whether the driver supports 'TRUNCATE'

#### Type

boolean

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

## Methods

### __construct()

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

Connect to a PosgreSQL database

#### Parameters

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

#

## Tags

codeCoverageIgnore |

### __call()

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

Allow invoke to work on table object

#### Parameters

string | $name |
array | $args |

#### Returns

mixed

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

codeCoverageIgnore |

### getLastQuery()

    getLastQuery() : string

Get the last sql query executed

#### Returns

string

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### setLastQuery()

    setLastQuery(string  $queryString) : void

Set the last query sql

#### Parameters

string | $queryString |

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### getSql()

    getSql() : \Query\Drivers\SQLInterface

Get the SQL class for the current driver

#### Returns

\Query\Drivers\SQLInterface

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### getUtil()

    getUtil() : \Query\Drivers\AbstractUtil

Get the Util class for the current driver

#### Returns

\Query\Drivers\AbstractUtil

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### setTablePrefix()

    setTablePrefix(string  $prefix) : void

Set the common table name prefix

#### Parameters

string | $prefix |

#

Inherited from
  \Query\Drivers\AbstractDriver

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

#

Inherited from
  \Query\Drivers\AbstractDriver

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

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### affectedRows()

    affectedRows() : integer

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

#### Returns

integer

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### prefixTable()

    prefixTable(string  $table) : string

Prefixes a table if it is not already prefixed

#### Parameters

string | $table |

#### Returns

string

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### quoteTable()

    quoteTable(string  $table) : string

Quote database table name, and set prefix

#### Parameters

string | $table |

#### Returns

string

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### quoteIdent()

    quoteIdent(mixed  $identifier) : string

Surrounds the string with the databases identifier escape characters

#### Parameters

mixed | $identifier |

#### Returns

string

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### getSchemas()

    getSchemas() : array

Get a list of schemas for the current connection

#### Returns

array

#

## Tags

None found

### getTables()

    getTables() : array

Return list of tables for the current database

#### Returns

array

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### getDbs()

    getDbs() : array

Return list of dbs for the current connection, if possible

#### Returns

array

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### getViews()

    getViews() : array

Return list of views for the current database

#### Returns

array

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### getSequences()

    getSequences() : array

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

#### Returns

array

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### getFunctions()

    getFunctions() : array

Return list of functions for the current database

#### Returns

array

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### getProcedures()

    getProcedures() : array

Return list of stored procedures for the current database

#### Returns

array

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### getTriggers()

    getTriggers() : array

Return list of triggers for the current database

#### Returns

array

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### getSystemTables()

    getSystemTables() : array

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

#### Returns

array

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### getColumns()

    getColumns(string  $table) : array

Retrieve column information for the current database table

#### Parameters

string | $table |

#### Returns

array

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### getFks()

    getFks(string  $table) : array

Retrieve foreign keys for the table

#### Parameters

string | $table |

#### Returns

array

#

## Tags

None found

### getIndexes()

    getIndexes(string  $table) : array

Retrieve indexes for the table

#### Parameters

string | $table |

#### Returns

array

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### getTypes()

    getTypes() : array

Retrieve list of data types for the database

#### Returns

array

#

Inherited from
  \Query\Drivers\AbstractDriver

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

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### numRows()

    numRows() : integer|null

Return the number of rows returned for a SELECT query

#### Returns

integer|null

#

Inherited from
  \Query\Drivers\AbstractDriver
See also
  http://us3.php.net/manual/en/pdostatement.rowcount.php#87110

## Tags

None found

### 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<string|array|\Query\Drivers\null>

#

Inherited from
  \Query\Drivers\AbstractDriver

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

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### _quote()

    _quote(mixed  $str) : mixed

Helper method for quote_ident

#### Parameters

mixed | $str |

#### Returns

mixed

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### truncate()

    truncate(string  $table) : \PDOStatement

Empty the passed table

#### Parameters

string | $table |

#### Returns

\PDOStatement

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### _loadSubClasses()

    _loadSubClasses() : void

Loads the subclasses for the driver

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### _prefix()

    _prefix(string  $str) : string

Sets the table prefix on the passed string

#### Parameters

string | $str |

#### Returns

string

#

Inherited from
  \Query\Drivers\AbstractDriver

## Tags

None found

### Driver.php