const ATTR_STATEMENT_CLASS = 13;
const ATTR_FETCH_TABLE_NAMES = 14;
const ATTR_FETCH_CATALOG_NAMES = 15;
- const ATTR_DRIVER_NAME = 16;
const ATTR_STRINGIFY_FETCHES = 17;
const ATTR_MAX_COLUMN_LEN = 18;
const ATTR_CONNECTION_STATUS = 7;
const ATTR_CURSOR = 10;
const ATTR_CURSOR_NAME = 9;
- const ATTR_DRIVER_NAME = 16;
const ATTR_ERRMODE = 3;
const ATTR_FETCH_CATALOG_NAMES = 15;
const ATTR_FETCH_TABLE_NAMES = 14;
$this->dbh = $adapter;
$this->isConnected = true;
} else if (is_array($adapter)) {
- $this->pendingAttributes[IPF_ORM::ATTR_DRIVER_NAME] = $adapter['scheme'];
-
$this->options['dsn'] = $adapter['dsn'];
$this->options['username'] = $adapter['user'];
$this->options['password'] = $adapter['pass'];
// attach the pending attributes to adapter
foreach($this->pendingAttributes as $attr => $value) {
- // some drivers don't support setting this so we just skip it
- if ($attr == IPF_ORM::ATTR_DRIVER_NAME) {
- continue;
- }
$this->dbh->setAttribute($attr, $value);
}
$this->_count++;
}
- public function driverName($name)
- {
- }
-
public function supports($feature)
{
return (isset($this->supported[$feature])
throw new IPF_ORM_Exception("First argument should be an instance of PDO");
$driverName = $adapter->getAttribute(PDO::ATTR_DRIVER_NAME);
} else if (is_array($adapter)) {
- if ( ! isset($adapter[0])) {
+ if (!isset($adapter[0]))
throw new IPF_ORM_Exception('Empty data source name given.');
- }
+
$e = explode(':', $adapter[0]);
if ($e[0] == 'uri') {
// initialize the base of the subquery
$subquery = 'SELECT DISTINCT ' . $this->_conn->quoteIdentifier($primaryKey);
- $driverName = $this->_conn->getAttribute(IPF_ORM::ATTR_DRIVER_NAME);
+ $driverName = $this->_conn->getDriverName();
// pgsql needs the order by fields to be preserved in select clause
- if ($driverName == 'pgsql') {
+ if ($driverName == 'Pgsql') {
foreach ($this->_sqlParts['orderby'] as $part) {
$part = trim($part);
$e = $this->_tokenizer->bracketExplode($part, ' ');
}
}
- if ($driverName == 'mysql' || $driverName == 'pgsql') {
+ if ($driverName == 'Mysql' || $driverName == 'Pgsql') {
foreach ($this->_expressionMap as $dqlAlias => $expr) {
if (isset($expr[1])) {
$subquery .= ', ' . $expr[0] . ' AS ' . $this->_aggregateAliasMap[$dqlAlias];
}
}
- if ($driverName == 'mysql' || $driverName == 'pgsql') {
+ if ($driverName == 'Mysql' || $driverName == 'Pgsql') {
foreach ($parts as $k => $part) {
if (strpos($part, "'") !== false) {
continue;
return "active";
break;
}
- }
+ }
public static function getConnectionAsString(IPF_ORM_Connection $connection)
{
$r[] = 'State : ' . IPF_ORM_Utils::getConnectionStateAsString($connection->transaction->getState());
$r[] = 'Open Transactions : ' . $connection->transaction->getTransactionLevel();
$r[] = 'Table in memory : ' . $connection->count();
- $r[] = 'Driver name : ' . $connection->getAttribute(IPF_ORM::ATTR_DRIVER_NAME);
+ $r[] = 'Driver name : ' . $connection->getDriverName();
$r[] = "</pre>";
return implode("\n",$r)."<br>";
}