Class

MssqlPropelPDO

class MssqlPropelPDO extends PropelPDO

dblib doesn't support transactions so we need to add a workaround for transactions, last insert ID, and quoting

Constants

PROPEL_ATTR_CACHE_PREPARES

Attribute to use to set whether to cache prepared statements.

PROPEL_ATTR_CONNECTION_NAME

Attribute to use to set the connection name useful for explains

DEFAULT_SLOW_THRESHOLD

DEFAULT_ONLYSLOW_ENABLED

Properties

boolean $useDebug Whether or not the debug is enabled

Methods

__construct(string $dsn, string $username = null, string $password = null, array $driver_options = array())

Creates a PropelPDO instance representing a connection to a database.

from PropelPDO
setConfiguration(PropelConfiguration $configuration)

Inject the runtime configuration

from PropelPDO
PropelConfiguration getConfiguration()

Get the runtime configuration

from PropelPDO
integer getNestedTransactionCount()

Gets the current transaction depth.

from PropelPDO
boolean isInTransaction()

Is this PDO connection currently in-transaction? This is equivalent to asking whether the current nested transaction count is greater than 0.

from PropelPDO
boolean isCommitable()

Check whether the connection contains a transaction that can be committed.

from PropelPDO
integer beginTransaction()

Begin a transaction.

integer commit()

Commit a transaction.

integer rollBack()

Roll-back a transaction.

integer forceRollBack()

Rollback the whole transaction, even if this is a nested rollback and reset the nested transaction count to 0.

void setAttribute(integer $attribute, mixed $value)

Sets a connection attribute.

from PropelPDO
mixed getAttribute(integer $attribute)

Gets a connection attribute.

from PropelPDO
PDOStatement prepare(string $sql, array $driver_options = array())

Prepares a statement for execution and returns a statement object.

from PropelPDO
integer exec(string $sql)

Execute an SQL statement and return the number of affected rows.

from PropelPDO
PDOStatement query()

Executes an SQL statement, returning a result set as a PDOStatement object.

from PropelPDO
clearStatementCache()

Clears any stored prepared statements for this connection.

from PropelPDO
integer getQueryCount()

Returns the number of queries this DebugPDO instance has performed on the database connection.

from PropelPDO
integer incrementQueryCount()

Increments the number of queries performed by this DebugPDO instance.

from PropelPDO
string getLastExecutedQuery()

Get the SQL code for the latest query executed by Propel

from PropelPDO
setLastExecutedQuery(string $query)

Set the SQL code for the latest query executed by Propel

from PropelPDO
useDebug(boolean $value = true)

Enable or disable the query debug features

from PropelPDO
setLogLevel(integer $level)

Sets the logging level to use for logging method calls and SQL statements.

from PropelPDO
setLogger(BasicLogger $logger)

Sets a logger to use.

from PropelPDO
BasicLogger getLogger()

Gets the logger in use.

from PropelPDO
log(string $msg, integer $level = null, string $methodName = null, array $debugSnapshot = null)

Logs the method call or SQL using the Propel::log() method or a registered logger class.

from PropelPDO
array getDebugSnapshot()

Returns a snapshot of the current values of some functions useful in debugging.

from PropelPDO
__destruct()

If so configured, makes an entry to the log of the state of this object just prior to its destruction.

from PropelPDO
integer lastInsertId(string $seqname = null)

string quoteIdentifier(string $text)

boolean useQuoteIdentifier()

Details

in PropelPDO at line 147
public __construct(string $dsn, string $username = null, string $password = null, array $driver_options = array())

Creates a PropelPDO instance representing a connection to a database.

. If so configured, specifies a custom PDOStatement class and makes an entry to the log with the state of this object just after its initialization. Add PropelPDO::__construct to $defaultLogMethods to see this message

Parameters

string $dsn Connection DSN.
string $username The user name for the DSN string.
string $password The password for the DSN string.
array $driver_options A key=>value array of driver-specific connection options.

Exceptions

PDOException if there is an error during connection initialization.

in PropelPDO at line 166
public setConfiguration(PropelConfiguration $configuration)

Inject the runtime configuration

Parameters

PropelConfiguration $configuration

in PropelPDO at line 176
public PropelConfiguration getConfiguration()

Get the runtime configuration

Return Value

PropelConfiguration

in PropelPDO at line 190
public integer getNestedTransactionCount()

Gets the current transaction depth.

Return Value

integer

in PropelPDO at line 211
public boolean isInTransaction()

Is this PDO connection currently in-transaction? This is equivalent to asking whether the current nested transaction count is greater than 0.

Return Value

boolean

in PropelPDO at line 222
public boolean isCommitable()

Check whether the connection contains a transaction that can be committed.

To be used in an environment where Propelexceptions are caught.

Return Value

boolean True if the connection is in a committable transaction

at line 26
public integer beginTransaction()

Begin a transaction.

It is necessary to override the abstract PDO transaction functions here, as the PDO driver for MSSQL does not support transactions.

Return Value

integer

at line 52
public integer commit()

Commit a transaction.

It is necessary to override the abstract PDO transaction functions here, as the PDO driver for MSSQL does not support transactions.

Return Value

integer

Exceptions

PropelException

at line 81
public integer rollBack()

Roll-back a transaction.

It is necessary to override the abstract PDO transaction functions here, as the PDO driver for MSSQL does not support transactions.

Return Value

integer Whether operation was successful.

at line 109
public integer forceRollBack()

Rollback the whole transaction, even if this is a nested rollback and reset the nested transaction count to 0.

It is necessary to override the abstract PDO transaction functions here, as the PDO driver for MSSQL does not support transactions.

Return Value

integer Whether operation was successful.

in PropelPDO at line 342
public void setAttribute(integer $attribute, mixed $value)

Sets a connection attribute.

This is overridden here to provide support for setting Propel-specific attributes too.

Parameters

integer $attribute The attribute to set (e.g. PropelPDO::PROPELATTRCACHE_PREPARES).
mixed $value The attribute value.

Return Value

void

in PropelPDO at line 365
public mixed getAttribute(integer $attribute)

Gets a connection attribute.

This is overridden here to provide support for setting Propel-specific attributes too.

Parameters

integer $attribute The attribute to get (e.g. PropelPDO::PROPELATTRCACHE_PREPARES).

Return Value

mixed

in PropelPDO at line 392
public PDOStatement prepare(string $sql, array $driver_options = array())

Prepares a statement for execution and returns a statement object.

Overrides PDO::prepare() in order to: - Add logging and query counting if logging is true. - Add query caching support if the PropelPDO::PROPELATTRCACHE_PREPARES was set to true.

Parameters

string $sql This must be a valid SQL statement for the target database server.
array $driver_options One $array or more key => value pairs to set attribute values for the PDOStatement object that this method returns.

Return Value

PDOStatement

in PropelPDO at line 424
public integer exec(string $sql)

Execute an SQL statement and return the number of affected rows.

Overrides PDO::exec() to log queries when required

Parameters

string $sql

Return Value

integer

in PropelPDO at line 451
public PDOStatement query()

Executes an SQL statement, returning a result set as a PDOStatement object.

Despite its signature here, this method takes a variety of parameters.

Overrides PDO::query() to log queries when required

Return Value

PDOStatement

See also

http://php.net/manual/en/pdo.query.php for a description of the possible parameters.

in PropelPDO at line 477
public clearStatementCache()

Clears any stored prepared statements for this connection.

in PropelPDO at line 509
public integer getQueryCount()

Returns the number of queries this DebugPDO instance has performed on the database connection.

When using DebugPDOStatement as the statement class, any queries by DebugPDOStatement instances are counted as well.

Return Value

integer

Exceptions

PropelException if persistent connection is used (since unable to override PDOStatement in that case).

in PropelPDO at line 526
public integer incrementQueryCount()

Increments the number of queries performed by this DebugPDO instance.

Returns the original number of queries (ie the value of $this->queryCount before calling this method).

Return Value

integer

in PropelPDO at line 536
public string getLastExecutedQuery()

Get the SQL code for the latest query executed by Propel

Return Value

string Executable SQL code

in PropelPDO at line 546
public setLastExecutedQuery(string $query)

Set the SQL code for the latest query executed by Propel

Parameters

string $query Executable SQL code

in PropelPDO at line 556
public useDebug(boolean $value = true)

Enable or disable the query debug features

Parameters

boolean $value True to enable debug (default), false to disable it

in PropelPDO at line 575
public setLogLevel(integer $level)

Sets the logging level to use for logging method calls and SQL statements.

Parameters

integer $level Value of one of the Propel::LOG_* class constants.

in PropelPDO at line 587
public setLogger(BasicLogger $logger)

Sets a logger to use.

The logger will be used by this class to log various method calls and their properties.

Parameters

BasicLogger $logger A Logger with an API compatible with BasicLogger (or PEAR Log).

in PropelPDO at line 597
public BasicLogger getLogger()

Gets the logger in use.

Return Value

BasicLogger A Logger with an API compatible with BasicLogger (or PEAR Log).

in PropelPDO at line 613
public log(string $msg, integer $level = null, string $methodName = null, array $debugSnapshot = null)

Logs the method call or SQL using the Propel::log() method or a registered logger class.

Parameters

string $msg Message to log.
integer $level Log level to use; will use self::setLogLevel() specified level by default.
string $methodName Name of the method whose execution is being logged.
array $debugSnapshot Previous return value from self::getDebugSnapshot().

See also

self::setLogger()

in PropelPDO at line 663
public array getDebugSnapshot()

Returns a snapshot of the current values of some functions useful in debugging.

Return Value

array

Exceptions

PropelException

in PropelPDO at line 800
public __destruct()

If so configured, makes an entry to the log of the state of this object just prior to its destruction.

Add PropelPDO::__destruct to $defaultLogMethods to see this message

See also

self::log()

at line 135
public integer lastInsertId(string $seqname = null)

Parameters

string $seqname

Return Value

integer

at line 147
public string quoteIdentifier(string $text)

Parameters

string $text

Return Value

string

at line 155
public boolean useQuoteIdentifier()

Return Value

boolean