Propel 2 API
Interface

Propel\Runtime\Connection\ConnectionInterface

interface ConnectionInterface

Interface for Propel Connection object.

Based on the PDO interface.

Methods

setName(string $name)

string getName()

boolean beginTransaction()

Turns off autocommit mode.

boolean commit()

Commits a transaction.

boolean rollBack()

Rolls back a transaction.

bool inTransaction()

Checks if inside a transaction.

mixed getAttribute(string $attribute)

Retrieve a database connection attribute.

boolean setAttribute(string $attribute, mixed $value)

Set an attribute.

string lastInsertId(string $name = null)

Returns the ID of the last inserted row or sequence value.

DataFetcherInterface getSingleDataFetcher($data $data)

DataFetcherInterface getDataFetcher($data $data)

Details

at line 25
public setName(string $name)

Parameters

string $name The datasource name associated to this connection

at line 30
public string getName()

Return Value

string The datasource name associated to this connection

at line 43
public boolean beginTransaction()

Turns off autocommit mode.

While autocommit mode is turned off, changes made to the database via
the Connection object instance are not committed until you end the
transaction by calling Connection::commit().
Calling Connection::rollBack() will roll back all changes to the database
and return the connection to autocommit mode.

Return Value

boolean TRUE on success or FALSE on failure.

at line 53
public boolean commit()

Commits a transaction.

commit() returns the database connection to autocommit mode until the
next call to connection::beginTransaction() starts a new transaction.

Return Value

boolean TRUE on success or FALSE on failure.

at line 65
public boolean rollBack()

Rolls back a transaction.

Rolls back the current transaction, as initiated by beginTransaction().
It is an error to call this method if no transaction is active.
If the database was set to autocommit mode, this function will restore
autocommit mode after it has rolled back the transaction.

Return Value

boolean TRUE on success or FALSE on failure.

at line 72
public bool inTransaction()

Checks if inside a transaction.

Return Value

bool TRUE if a transaction is currently active, and FALSE if not.

at line 83
public mixed getAttribute(string $attribute)

Retrieve a database connection attribute.

Parameters

string $attribute The name of the attribute to retrieve, e.g. PDO::ATTR_AUTOCOMMIT

Return Value

mixed A successful call returns the value of the requested attribute. An unsuccessful call returns null.

at line 93
public boolean setAttribute(string $attribute, mixed $value)

Set an attribute.

Parameters

string $attribute
mixed $value

Return Value

boolean TRUE on success or FALSE on failure.

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

Parameters

string $name Name of the sequence object from which the ID should be returned.

Return Value

string If a sequence name was not specified for the name parameter, returns a string representing the row ID of the last row that was inserted into the database. If a sequence name was specified for the name parameter, returns a string representing the last value retrieved from the specified sequence object.

at line 119
public DataFetcherInterface getSingleDataFetcher($data $data)

Parameters

$data $data

Return Value

DataFetcherInterface

at line 126
public DataFetcherInterface getDataFetcher($data $data)

Parameters

$data $data

Return Value

DataFetcherInterface