Propel 2 API
Class

Propel\Runtime\Connection\PdoConnection

class PdoConnection extends PDO implements SqlConnectionInterface

PDO extension that implements ConnectionInterface and builds statements implementing StatementInterface.

Methods

setName(string $name)

string getName()

__construct($dsn, $user = null, $password = null, array $options = null)

Creates a PDO instance representing a connection to a database.

bool setAttribute(integer $attribute, mixed $value)

Sets a connection attribute.

DataFetcherInterface getDataFetcher($data $data)

DataFetcherInterface getSingleDataFetcher($data $data)

DataFetcherInterface query(string $statement)

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

int exec(string $statement)

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

Details

at line 29
public setName(string $name)

Parameters

string $name The datasource name associated to this connection

at line 37
public string getName()

Return Value

string The datasource name associated to this connection

at line 45
public __construct($dsn, $user = null, $password = null, array $options = null)

Creates a PDO instance representing a connection to a database.

Parameters

$dsn
$user
$password
array $options

at line 64
public bool setAttribute(integer $attribute, mixed $value)

Sets a connection attribute.

This is overridden here to allow names corresponding to PDO constant names.

Parameters

integer $attribute The attribute to set (e.g. 'PDO::ATTR_CASE', or more simply 'ATTR_CASE').
mixed $value The attribute value.

Return Value

bool TRUE on success or FALSE on failure.

Exceptions

InvalidArgumentException

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

Parameters

$data $data

Return Value

DataFetcherInterface

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

Parameters

$data $data

Return Value

DataFetcherInterface

at line 96
public DataFetcherInterface query(string $statement)

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

Parameters

string $statement The SQL statement to prepare and execute. Data inside the query should be properly escaped.

Return Value

DataFetcherInterface

Exceptions

ConnectionException depending on error handling.

at line 106
public int exec(string $statement)

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

Parameters

string $statement The SQL statement to prepare and execute. Data inside the query should be properly escaped.

Return Value

int The number of rows that were modified or deleted by the SQL statement you issued. If no rows were affected, returns 0.