Class

DBMSSQL

class DBMSSQL extends DBAdapter

This is used to connect to a MSSQL database.

Constants

ID_METHOD_NONE

ID_METHOD_AUTOINCREMENT

ID_METHOD_SEQUENCE

Methods

static DBAdapter factory(string $driver)

Creates a new instance of the database adapter associated with the specified Propel driver.

from DBAdapter
array prepareParams(array $settings)

Prepare connection parameters.

from DBAdapter
initConnection(PDO $con, array $settings)

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

from DBAdapter
setCharset(PDO $con, string $charset)

MS SQL Server does not support SET NAMES

string toUpperCase(string $in)

This method is used to ignore case.

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 DBAdapter
string ignoreCase(string $in)

This method is used to ignore case.

string ignoreCaseInOrderBy(string $in)

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

from DBAdapter
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.

string quoteIdentifier(string $text)

string quoteIdentifierTable(string $table)

boolean isGetIdBeforeInsert()

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

from DBAdapter
boolean isGetIdAfterInsert()

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

from DBAdapter
mixed getId(PDO $con, string $name = null)

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

from DBAdapter
string formatTemporalValue(mixed $value, mixed $type)

Formats a temporal value before binding, given a ColumnMap object.

from DBAdapter
string getTimestampFormatter()

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

from DBAdapter
string getDateFormatter()

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

from DBAdapter
string getTimeFormatter()

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

from DBAdapter
useQuoteIdentifier()

Should Column-Names get identifiers for inserts or updates.

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

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

Simulated Limit/Offset

string random(string $seed = null)

string getDeleteFromClause(Criteria $criteria, string $tableName)

Returns the "DELETE FROM

[AS ]" part of DELETE query.

from DBAdapter
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 DBAdapter
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 Moved from BasePeer to DBAdapter and turned from static to non static

from DBAdapter
bindValues(PDOStatement $stmt, array $params, DatabaseMap $dbMap)

Binds values in a prepared statement.

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

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

from DBAdapter
PDOStatement doExplainPlan(PropelPDO $con, ModelCriteria|string $query)

Do Explain Plan for query object or query string

from DBAdapter

Details

in DBAdapter at line 66
static public DBAdapter factory(string $driver)

Creates a new instance of the database adapter associated with the specified Propel driver.

Parameters

string $driver The name of the Propel driver to create a new adapter instance for or a shorter form adapter key.

Return Value

DBAdapter An instance of a Propel database adapter.

Exceptions

PropelException If the adapter could not be instantiated.

in DBAdapter at line 85
public array prepareParams(array $settings)

Prepare connection parameters.

Parameters

array $settings

Return Value

array

in DBAdapter at line 104
public initConnection(PDO $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

PDO $con A PDO connection instance.
array $settings An array of settings.

See also

setCharset()

at line 28
public setCharset(PDO $con, string $charset)

MS SQL Server does not support SET NAMES

Parameters

PDO $con A $PDO PDO connection instance.
string $charset The $string charset encoding.

See also

DBAdapter::setCharset()

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

at line 51
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 DBAdapter at line 174
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.

at line 64
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 78
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 90
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 102
public string quoteIdentifier(string $text)

Parameters

string $text The identifier to quote.

Return Value

string The quoted identifier.

See also

DBAdapter::quoteIdentifier()

at line 114
public string quoteIdentifierTable(string $table)

Parameters

string $table The table name to quo

Return Value

string The quoted table name

See also

DBAdapter::quoteIdentifierTable()

in DBAdapter at line 250
public boolean isGetIdBeforeInsert()

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

Return Value

boolean

in DBAdapter at line 260
public boolean isGetIdAfterInsert()

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

Return Value

boolean

in DBAdapter at line 275
public mixed getId(PDO $con, string $name = null)

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

Warning: duplicates logic from DefaultPlatform::getIdentifierPhp(). Any code modification here must be ported there.

Parameters

PDO $con
string $name

Return Value

mixed

in DBAdapter at line 288
public string formatTemporalValue(mixed $value, mixed $type)

Formats a temporal value before binding, given a ColumnMap object.

Parameters

mixed $value The temporal value
mixed $type PropelColumnTypes constant, or ColumnMap object

Return Value

string The formatted temporal value

in DBAdapter at line 318
public string getTimestampFormatter()

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

Return Value

string

in DBAdapter at line 328
public string getDateFormatter()

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

Return Value

string

in DBAdapter at line 338
public string getTimeFormatter()

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

Return Value

string

in DBAdapter at line 354
public useQuoteIdentifier()

Should Column-Names get identifiers for inserts or updates.

By default false is returned -> backwards compability.

it`s a workaround...!!!

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

Parameters

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

See also

parent::cleanupSQL()

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

Simulated Limit/Offset

This rewrites the $sql query to apply the offset and limit. some of the ORDER BY logic borrowed from Doctrine MsSqlPlatform

Parameters

string $sql
integer $offset
integer $limit

Return Value

void

Exceptions

PropelException
Exception

See also

DBAdapter::applyLimit()

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

Parameters

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

Return Value

string

See also

DBAdapter::random()

in DBAdapter at line 395
public string getDeleteFromClause(Criteria $criteria, string $tableName)

Returns the "DELETE FROM

[AS ]" part of DELETE query.

Parameters

Criteria $criteria
string $tableName

Return Value

string

in DBAdapter at line 427
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) Move from BasePeer to DBAdapter and turn from static to non static

Parameters

Criteria $criteria
array $fromClause
boolean $aliasAll

Return Value

string

in DBAdapter at line 499
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 Moved from BasePeer to DBAdapter and turned from static to non static

Parameters

Criteria $criteria

Return Value

Criteria The input, with Select columns replaced by aliases

See also

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

in DBAdapter at line 549
public bindValues(PDOStatement $stmt, array $params, DatabaseMap $dbMap)

Binds values in a prepared statement.

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

$db = Propel::getDB($criteria->getDbName()); $sql = BasePeer::createSelectSql($criteria, $params); $stmt = $con->prepare($sql); $params = array(); $db->populateStmtValues($stmt, $params, Propel::getDatabaseMap($critera->getDbName())); $stmt->execute();

Parameters

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

in DBAdapter at line 585
public boolean bindValue(PDOStatement $stmt, string $parameter, mixed $value, ColumnMap $cMap, null|integer $position = null)

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

Warning: duplicates logic from DefaultPlatform::getColumnBindingPHP(). Any code modification here must be ported there.

Parameters

PDOStatement $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

in DBAdapter at line 607
public PDOStatement doExplainPlan(PropelPDO $con, ModelCriteria|string $query)

Do Explain Plan for query object or query string

Parameters

PropelPDO $con propel connection
ModelCriteria|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 if explain plan is not implemented for adapter