Propel 2 API
Class

Propel\Runtime\Adapter\Pdo\PgsqlAdapter

class PgsqlAdapter extends PdoAdapter implements SqlAdapterInterface

This is used to connect to PostgreSQL databases.

Methods

PdoConnection getConnection(array $conparams)

Build database connection

from PdoAdapter
initConnection(ConnectionInterface $con, array $settings)

This method is called after a connection was created to run necessary post-initialization queries or code.

from PdoAdapter
setCharset(ConnectionInterface $con, string $charset)

Sets the character encoding using SQL standard SET NAMES statement.

from PdoAdapter
string toUpperCase(string $in)

This method is used to ignore case.

from PdoAdapter
string ignoreCase(string $in)

This method is used to ignore case.

from PdoAdapter
string ignoreCaseInOrderBy(string $in)

This method is used to ignore case in an ORDER BY clause.

from PdoAdapter
string getStringDelimiter()

Returns the character used to indicate the beginning and end of a piece of text used in a SQL statement (generally a single quote).

from PdoAdapter
string quoteIdentifier(string $text)

Quotes database object identifiers (table names, col names, sequences, etc.).

from PdoAdapter
string quoteIdentifierTable(string $table)

boolean isGetIdBeforeInsert()

Whether this adapter uses an ID generation system that requires getting ID _before_ performing INSERT.

from PdoAdapter
boolean isGetIdAfterInsert()

Whether this adapter uses an ID generation system that requires getting ID _before_ performing INSERT.

from PdoAdapter
integer getId(ConnectionInterface $con, string $name = null)

Gets ID for specified sequence name.

string formatTemporalValue(mixed $value, ColumnMap $cMap)

Formats a temporal value before binding, given a ColumnMap object

from PdoAdapter
string getTimestampFormatter()

Returns timestamp formatter string for use in date() function.

string getDateFormatter()

Returns date formatter string for use in date() function.

from PdoAdapter
string getTimeFormatter()

Returns timestamp formatter string for use in date() function.

useQuoteIdentifier()

Should Column-Names get identifiers for inserts or updates.

from PdoAdapter
cleanupSQL(string $sql, array $params, Criteria $values, DatabaseMap $dbMap)

Allows manipulation of the query string before StatementPdo is instantiated.

from PdoAdapter
string getDeleteFromClause(Criteria $criteria, string $tableName)

string createSelectSqlPart(Criteria $criteria, array $fromClause, boolean $aliasAll = false)

Builds the SELECT part of a SQL statement based on a Criteria taking into account select columns and 'as' columns (i.e.

from PdoAdapter
Criteria turnSelectColumnsToAliases(Criteria $criteria)

Ensures uniqueness of select column names by turning them all into aliases This is necessary for queries on more than one table when the tables share a column name

from PdoAdapter
bindValues(StatementInterface $stmt, array $params, DatabaseMap $dbMap)

Binds values in a prepared statement.

from PdoAdapter
boolean bindValue(StatementInterface $stmt, string $parameter, mixed $value, ColumnMap $cMap, null|integer $position = null)

Binds a value to a positioned parameter in a statement, given a ColumnMap object to infer the binding type.

from PdoAdapter
string concatString(string $s1, string $s2)

Returns SQL which concatenates the second string to the first.

string subString(string $s, integer $pos, integer $len)

Returns SQL which extracts a substring.

string strLength(string $s)

Returns SQL which calculates the length (in chars) of a string.

applyLimit(string $sql, integer $offset, integer $limit)

string random(string $seed = null)

PDOStatement doExplainPlan(ConnectionInterface $con, Criteria|string $query)

Do Explain Plan for query object or query string

getExplainPlanQuery(string $query)

Explain Plan compute query getter

Details

in PdoAdapter at line 40
public PdoConnection getConnection(array $conparams)

Build database connection

Parameters

array $conparams connection parameters

Return Value

PdoConnection

Exceptions

InvalidArgumentException
AdapterException

in PdoAdapter at line 104
public initConnection(ConnectionInterface $con, array $settings)

This method is called after a connection was created to run necessary post-initialization queries or code.

If a charset was specified, this will be set before any other queries
are executed.

This base method runs queries specified using the "query" setting.

Parameters

ConnectionInterface $con
array $settings An array of settings.

See also

setCharset()

in PdoAdapter at line 130
public setCharset(ConnectionInterface $con, string $charset)

Sets the character encoding using SQL standard SET NAMES statement.

This method is invoked from the default initConnection() method and must
be overridden for an RDMBS which does _not_ support this SQL standard.

Parameters

ConnectionInterface $con
string $charset The $string charset encoding.

See also

initConnection()

in PdoAdapter at line 141
public string toUpperCase(string $in)

This method is used to ignore case.

Parameters

string $in The string to transform to upper case.

Return Value

string The upper case string.

in PdoAdapter at line 152
public string ignoreCase(string $in)

This method is used to ignore case.

Parameters

string $in The string whose case to ignore.

Return Value

string The string in a case that can be ignored.

in PdoAdapter at line 166
public string ignoreCaseInOrderBy(string $in)

This method is used to ignore case in an ORDER BY clause.

Usually it is the same as ignoreCase, but some databases
(Interbase for example) does not use the same SQL in ORDER BY
and other clauses.

Parameters

string $in The string whose case to ignore.

Return Value

string The string in a case that can be ignored.

in PdoAdapter at line 178
public string getStringDelimiter()

Returns the character used to indicate the beginning and end of a piece of text used in a SQL statement (generally a single quote).

Return Value

string The text delimiter.

in PdoAdapter at line 188
public string quoteIdentifier(string $text)

Quotes database object identifiers (table names, col names, sequences, etc.).

Parameters

string $text The identifier to quote.

Return Value

string The quoted identifier.

at line 175
public string quoteIdentifierTable(string $table)

Parameters

string $table The table name to quo

Return Value

string The quoted table name

See also

AdapterInterface::quoteIdentifierTable()

in PdoAdapter at line 222
public boolean isGetIdBeforeInsert()

Whether this adapter uses an ID generation system that requires getting ID _before_ performing INSERT.

Return Value

boolean

in PdoAdapter at line 232
public boolean isGetIdAfterInsert()

Whether this adapter uses an ID generation system that requires getting ID _before_ performing INSERT.

Return Value

boolean

at line 83
public integer getId(ConnectionInterface $con, string $name = null)

Gets ID for specified sequence name.

Parameters

ConnectionInterface $con
string $name

Return Value

integer

in PdoAdapter at line 258
public string formatTemporalValue(mixed $value, ColumnMap $cMap)

Formats a temporal value before binding, given a ColumnMap object

Parameters

mixed $value The temporal value
ColumnMap $cMap

Return Value

string The formatted temporal value

at line 97
public string getTimestampFormatter()

Returns timestamp formatter string for use in date() function.

Return Value

string

in PdoAdapter at line 295
public string getDateFormatter()

Returns date formatter string for use in date() function.

Return Value

string

at line 107
public string getTimeFormatter()

Returns timestamp formatter string for use in date() function.

Return Value

string

in PdoAdapter at line 320
public useQuoteIdentifier()

Should Column-Names get identifiers for inserts or updates.

By default false is returned -> backwards compatibility.

it`s a workaround...!!!

in PdoAdapter at line 333
public cleanupSQL(string $sql, array $params, Criteria $values, DatabaseMap $dbMap)

Allows manipulation of the query string before StatementPdo is instantiated.

Parameters

string $sql The sql statement
array $params array('column' => ..., 'table' => ..., 'value' => ...)
Criteria $values
DatabaseMap $dbMap

at line 148
public string getDeleteFromClause(Criteria $criteria, string $tableName)

Parameters

Criteria $criteria
string $tableName

Return Value

string

See also

PdoAdapter::getDeleteFromClause()

in PdoAdapter at line 377
public string createSelectSqlPart(Criteria $criteria, array $fromClause, boolean $aliasAll = false)

Builds the SELECT part of a SQL statement based on a Criteria taking into account select columns and 'as' columns (i.e.

columns aliases)

Parameters

Criteria $criteria
array $fromClause
boolean $aliasAll

Return Value

string

in PdoAdapter at line 448
public Criteria turnSelectColumnsToAliases(Criteria $criteria)

Ensures uniqueness of select column names by turning them all into aliases This is necessary for queries on more than one table when the tables share a column name

Parameters

Criteria $criteria

Return Value

Criteria The input, with Select columns replaced by aliases

See also

http://propel.phpdb.org/trac/ticket/795

in PdoAdapter at line 498
public bindValues(StatementInterface $stmt, array $params, DatabaseMap $dbMap)

Binds values in a prepared statement.

This method is designed to work with the Criteria::createSelectSql() method, which creates
both the SELECT SQL statement and populates a passed-in array of parameter
values that should be substituted.

<code>
$adapter = Propel::getServiceContainer()->getAdapter($criteria->getDbName());
$sql = $criteria->createSelectSql($params);
$stmt = $con->prepare($sql);
$params = array();
$adapter->populateStmtValues($stmt, $params, Propel::getServiceContainer()->getDatabaseMap($critera->getDbName()));
$stmt->execute();
</code>

Parameters

StatementInterface $stmt
array $params array('column' => ..., 'table' => ..., 'value' => ...)
DatabaseMap $dbMap

in PdoAdapter at line 532
public boolean bindValue(StatementInterface $stmt, string $parameter, mixed $value, ColumnMap $cMap, null|integer $position = null)

Binds a value to a positioned parameter in a statement, given a ColumnMap object to infer the binding type.

Parameters

StatementInterface $stmt The statement to bind
string $parameter Parameter identifier
mixed $value The value to bind
ColumnMap $cMap The ColumnMap of the column to bind
null|integer $position The position of the parameter to bind

Return Value

boolean

at line 35
public string concatString(string $s1, string $s2)

Returns SQL which concatenates the second string to the first.

Parameters

string $s1 String to concatenate.
string $s2 String to append.

Return Value

string

at line 49
public string subString(string $s, integer $pos, integer $len)

Returns SQL which extracts a substring.

Parameters

string $s String to extract from.
integer $pos Offset to start from.
integer $len Number of characters to extract.

Return Value

string

at line 60
public string strLength(string $s)

Returns SQL which calculates the length (in chars) of a string.

Parameters

string $s String to calculate length of.

Return Value

string

at line 119
public applyLimit(string $sql, integer $offset, integer $limit)

Parameters

string $sql
integer $offset
integer $limit

See also

AdapterInterface::applyLimit()

at line 135
public string random(string $seed = null)

Parameters

string $seed (optional) seed value for databases that support this

Return Value

string

See also

AdapterInterface::random()

at line 190
public PDOStatement doExplainPlan(ConnectionInterface $con, Criteria|string $query)

Do Explain Plan for query object or query string

Parameters

ConnectionInterface $con propel connection
Criteria|string $query query the criteria or the query string

Return Value

PDOStatement A PDO statement executed using the connection, ready to be fetched

Exceptions

PropelException

at line 216
public getExplainPlanQuery(string $query)

Explain Plan compute query getter

Parameters

string $query query to explain