class PropelPDO extends ConnectionWrapper
Class kept for BC sake - the functionality of the old PropelPDO class was moved to: - AbstractConnection for the nested transactions, and logging - PDOConnection for the PDO wrapper
Constants
PROPEL_ATTR_CACHE_PREPARES |
Attribute to use to set whether to cache prepared statements. |
Properties
boolean | $useDebug | Whether or not the debug is enabled |
Methods
__construct(ConnectionInterface $connection)
Creates a Connection instance. |
from ConnectionWrapper | |
setName(string $name) | from ConnectionWrapper | |
string | getName() | from ConnectionWrapper |
ConnectionInterface | getWrappedConnection() | from ConnectionWrapper |
integer |
getNestedTransactionCount()
Gets the current transaction depth. |
from ConnectionWrapper |
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 ConnectionWrapper |
boolean |
isCommitable()
Check whether the connection contains a transaction that can be committed. |
from ConnectionWrapper |
boolean |
beginTransaction()
Overrides PDO::beginTransaction() to prevent errors due to already-in-progress transaction. |
from ConnectionWrapper |
boolean |
commit()
Overrides PDO::commit() to only commit the transaction if we are in the outermost transaction nesting level. |
from ConnectionWrapper |
boolean |
rollBack()
Overrides PDO::rollBack() to only rollback the transaction if we are in the outermost transaction nesting level |
from ConnectionWrapper |
boolean |
forceRollBack()
Rollback the whole transaction, even if this is a nested rollback and reset the nested transaction count to 0. |
from ConnectionWrapper |
boolean |
inTransaction()
Checks if inside a transaction. |
from ConnectionWrapper |
mixed |
getAttribute(string $attribute)
Retrieve a database connection attribute. |
from ConnectionWrapper |
boolean |
setAttribute(string $attribute, mixed $value)
Set an attribute. |
from ConnectionWrapper |
StatementInterface |
prepare(string $sql, array $driver_options = array())
Prepares a statement for execution and returns a statement object. |
from ConnectionWrapper |
integer |
exec(string $sql)
Execute an SQL statement and return the number of affected rows. |
from ConnectionWrapper |
StatementInterface |
query()
Executes an SQL statement, returning a result set as a PDOStatement object. |
from ConnectionWrapper |
string |
quote(string $string, int $parameter_type = 2)
Quotes a string for use in a query. |
from ConnectionWrapper |
DataFetcherInterface | getSingleDataFetcher($data $data) | from ConnectionWrapper |
DataFetcherInterface | getDataFetcher($data $data) | from ConnectionWrapper |
string |
lastInsertId(string $name = null)
Returns the ID of the last inserted row or sequence value. |
from ConnectionWrapper |
clearStatementCache()
Clears any stored prepared statements for this connection. |
from ConnectionWrapper | |
integer |
getQueryCount()
Returns the number of queries this DebugPDO instance has performed on the database connection. |
from ConnectionWrapper |
integer |
incrementQueryCount()
Increments the number of queries performed by this DebugPDO instance. |
from ConnectionWrapper |
string |
getLastExecutedQuery()
Get the SQL code for the latest query executed by Propel |
from ConnectionWrapper |
setLastExecutedQuery(string $query)
Set the SQL code for the latest query executed by Propel |
from ConnectionWrapper | |
useDebug(boolean $value = true)
Enable or disable the query debug features |
from ConnectionWrapper | |
setLogMethods(array $logMethods) | from ConnectionWrapper | |
array | getLogMethods() | from ConnectionWrapper |
setLogger(LoggerInterface $logger)
{@inheritDoc} |
from ConnectionWrapper | |
LoggerInterface |
getLogger()
Gets the logger to use for this connection. |
from ConnectionWrapper |
log(string $msg)
Logs the method call or the executed SQL statement. |
from ConnectionWrapper | |
__call($method, $args)
Forward any call to a method not found to the wrapped connection. |
from ConnectionWrapper | |
__destruct()
If so configured, makes an entry to the log of the state of this object just prior to its destruction. |
from ConnectionWrapper |
Details
in ConnectionWrapper at line 121
public
__construct(ConnectionInterface $connection)
Creates a Connection instance.
in ConnectionWrapper at line 132
public
setName(string $name)
in ConnectionWrapper at line 140
public string
getName()
in ConnectionWrapper at line 148
public ConnectionInterface
getWrappedConnection()
in ConnectionWrapper at line 158
public integer
getNestedTransactionCount()
Gets the current transaction depth.
in ConnectionWrapper at line 178
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.
in ConnectionWrapper at line 189
public boolean
isCommitable()
Check whether the connection contains a transaction that can be committed.
To be used in an environment where Propelexceptions are caught.
in ConnectionWrapper at line 199
public boolean
beginTransaction()
Overrides PDO::beginTransaction() to prevent errors due to already-in-progress transaction.
in ConnectionWrapper at line 220
public boolean
commit()
Overrides PDO::commit() to only commit the transaction if we are in the outermost transaction nesting level.
in ConnectionWrapper at line 249
public boolean
rollBack()
Overrides PDO::rollBack() to only rollback the transaction if we are in the outermost transaction nesting level
in ConnectionWrapper at line 276
public boolean
forceRollBack()
Rollback the whole transaction, even if this is a nested rollback and reset the nested transaction count to 0.
in ConnectionWrapper at line 302
public boolean
inTransaction()
Checks if inside a transaction.
in ConnectionWrapper at line 316
public mixed
getAttribute(string $attribute)
Retrieve a database connection attribute.
in ConnectionWrapper at line 335
public boolean
setAttribute(string $attribute, mixed $value)
Set an attribute.
in ConnectionWrapper at line 365
public StatementInterface
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::PROPEL_ATTR_CACHE_PREPARES was set to true.
in ConnectionWrapper at line 392
public integer
exec(string $sql)
Execute an SQL statement and return the number of affected rows.
Overrides PDO::exec() to log queries when required
in ConnectionWrapper at line 415
public StatementInterface
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
in ConnectionWrapper at line 445
public string
quote(string $string, int $parameter_type = 2)
Quotes a string for use in a query.
Places quotes around the input string (if required) and escapes special
characters within the input string, using a quoting style appropriate to
the underlying driver.
in ConnectionWrapper at line 453
public DataFetcherInterface
getSingleDataFetcher($data $data)
in ConnectionWrapper at line 461
public DataFetcherInterface
getDataFetcher($data $data)
in ConnectionWrapper at line 483
public string
lastInsertId(string $name = null)
Returns the ID of the last inserted row or sequence value.
Returns the ID of the last inserted row, or the last value from a sequence
object, depending on the underlying driver. For example, PDO_PGSQL()
requires you to specify the name of a sequence object for the name parameter.
in ConnectionWrapper at line 491
public
clearStatementCache()
Clears any stored prepared statements for this connection.
in ConnectionWrapper at line 504
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.
in ConnectionWrapper at line 516
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).
in ConnectionWrapper at line 526
public string
getLastExecutedQuery()
Get the SQL code for the latest query executed by Propel
in ConnectionWrapper at line 536
public
setLastExecutedQuery(string $query)
Set the SQL code for the latest query executed by Propel
in ConnectionWrapper at line 546
public
useDebug(boolean $value = true)
Enable or disable the query debug features
in ConnectionWrapper at line 560
public
setLogMethods(array $logMethods)
in ConnectionWrapper at line 568
public array
getLogMethods()
in ConnectionWrapper at line 581
public
setLogger(LoggerInterface $logger)
{@inheritDoc}
in ConnectionWrapper at line 592
public LoggerInterface
getLogger()
Gets the logger to use for this connection.
If no logger was set, returns the default logger from the Service Container.
in ConnectionWrapper at line 606
public
log(string $msg)
Logs the method call or the executed SQL statement.
in ConnectionWrapper at line 623
public
__call($method, $args)
Forward any call to a method not found to the wrapped connection.
in ConnectionWrapper at line 633
public
__destruct()
If so configured, makes an entry to the log of the state of this object just prior to its destruction.