Propel 2 API
Interface

Propel\Runtime\Adapter\SqlAdapterInterface

interface SqlAdapterInterface implements AdapterInterface

Interface for adapters.

Methods

ConnectionInterface getConnection(array $conparams)

Build database connection

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

Sets the character encoding using SQL standard SET NAMES statement.

from AdapterInterface
string ignoreCaseInOrderBy(string $in)

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

from AdapterInterface
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 AdapterInterface
string concatString(string $s1, string $s2)

Returns SQL which concatenates the second string to the first.

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

Returns SQL which extracts a substring.

from AdapterInterface
string strLength(string $s)

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

from AdapterInterface
string quoteIdentifier(string $text)

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

from AdapterInterface
string quoteIdentifierTable(string $table)

Quotes a database table which could have space separating it from an alias, both should be identified separately.

from AdapterInterface
boolean isGetIdBeforeInsert()

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

from AdapterInterface
boolean isGetIdAfterInsert()

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

from AdapterInterface
mixed getId(ConnectionInterface $con, string $name = null)

Gets the generated ID (either last ID for autoincrement or next sequence ID).

from AdapterInterface
string formatTemporalValue(mixed $value, ColumnMap $cMap)

Formats a temporal value before binding, given a ColumnMap object

from AdapterInterface
string getTimestampFormatter()

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

from AdapterInterface
string getDateFormatter()

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

from AdapterInterface
string getTimeFormatter()

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

from AdapterInterface
useQuoteIdentifier()

Should Column-Names get identifiers for inserts or updates.

from AdapterInterface
string toUpperCase(string $in)

This method is used to ignore case.

string ignoreCase(string $in)

This method is used to ignore case.

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

Allows manipulation of the query string before StatementPdo is instantiated.

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

Modifies the passed-in SQL to add LIMIT and/or OFFSET.

random(mixed $seed = null)

Gets the SQL string that this adapter uses for getting a random number.

string getDeleteFromClause(Criteria $criteria, string $tableName)

Returns the "DELETE FROM <table> [AS <alias>]" part of DELETE query.

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.

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

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

Binds values in a prepared statement.

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.

Details

in AdapterInterface at line 33
public ConnectionInterface getConnection(array $conparams)

Build database connection

Parameters

array $conparams connection parameters

Return Value

ConnectionInterface

in AdapterInterface at line 46
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 AdapterInterface at line 57
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 AdapterInterface at line 66
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 AdapterInterface at line 76
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

in AdapterInterface at line 87
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

in AdapterInterface at line 95
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

in AdapterInterface at line 102
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.

in AdapterInterface at line 113
public string quoteIdentifierTable(string $table)

Quotes a database table which could have space separating it from an alias, both should be identified separately.

This doesn't take care of dots which
separate schema names from table names. Adapters for RDBMs which support
schemas have to implement that in the platform-specific way.

Parameters

string $table The table name to quo

Return Value

string The quoted table name

in AdapterInterface at line 120
public boolean isGetIdBeforeInsert()

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

Return Value

boolean

in AdapterInterface at line 127
public boolean isGetIdAfterInsert()

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

Return Value

boolean

in AdapterInterface at line 137
public mixed getId(ConnectionInterface $con, string $name = null)

Gets the generated ID (either last ID for autoincrement or next sequence ID).

Parameters

ConnectionInterface $con
string $name

Return Value

mixed

in AdapterInterface at line 147
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

in AdapterInterface at line 154
public string getTimestampFormatter()

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

Return Value

string

in AdapterInterface at line 161
public string getDateFormatter()

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

Return Value

string

in AdapterInterface at line 168
public string getTimeFormatter()

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

Return Value

string

in AdapterInterface at line 181
public useQuoteIdentifier()

Should Column-Names get identifiers for inserts or updates.

By default false is returned -> backwards compatibility.

it`s a workaround...!!!

at line 31
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.

at line 39
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.

at line 49
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 58
public applyLimit(string $sql, integer $offset, integer $limit)

Modifies the passed-in SQL to add LIMIT and/or OFFSET.

Parameters

string $sql
integer $offset
integer $limit

at line 65
public random(mixed $seed = null)

Gets the SQL string that this adapter uses for getting a random number.

Parameters

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

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

Returns the "DELETE FROM <table> [AS <alias>]" part of DELETE query.

Parameters

Criteria $criteria
string $tableName

Return Value

string

at line 87
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

at line 98
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

at line 120
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($criteria->getDbName()));
$stmt->execute();
</code>

Parameters

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

at line 134
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