From: Andrey Kutejko Date: Sat, 8 Jun 2013 18:18:26 +0000 (+0300) Subject: remove attr DRIVER_NAME X-Git-Tag: 0.5~263 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=16f88a1f94a6ea1855fca9d7dcb2a3763b36ef73;p=ipf.git remove attr DRIVER_NAME --- diff --git a/ipf/orm.php b/ipf/orm.php index 42a4e96..797f793 100644 --- a/ipf/orm.php +++ b/ipf/orm.php @@ -94,7 +94,6 @@ final class IPF_ORM { 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; diff --git a/ipf/orm/adapter.php b/ipf/orm/adapter.php index 1ca145a..363cade 100644 --- a/ipf/orm/adapter.php +++ b/ipf/orm/adapter.php @@ -8,7 +8,6 @@ class IPF_ORM_Adapter 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; diff --git a/ipf/orm/connection.php b/ipf/orm/connection.php index 13c2c82..7e1cfd8 100644 --- a/ipf/orm/connection.php +++ b/ipf/orm/connection.php @@ -56,8 +56,6 @@ abstract class IPF_ORM_Connection extends IPF_ORM_Configurable implements Counta $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']; @@ -239,10 +237,6 @@ abstract class IPF_ORM_Connection extends IPF_ORM_Configurable implements Counta // 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); } @@ -257,10 +251,6 @@ abstract class IPF_ORM_Connection extends IPF_ORM_Configurable implements Counta $this->_count++; } - public function driverName($name) - { - } - public function supports($feature) { return (isset($this->supported[$feature]) diff --git a/ipf/orm/manager.php b/ipf/orm/manager.php index 93dfa13..b32b49d 100644 --- a/ipf/orm/manager.php +++ b/ipf/orm/manager.php @@ -85,9 +85,9 @@ class IPF_ORM_Manager extends IPF_ORM_Configurable implements Countable, Iterato 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') { diff --git a/ipf/orm/query.php b/ipf/orm/query.php index 7124026..b087a6d 100644 --- a/ipf/orm/query.php +++ b/ipf/orm/query.php @@ -869,10 +869,10 @@ class IPF_ORM_Query extends IPF_ORM_Query_Abstract implements Countable, Seriali // 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, ' '); @@ -894,7 +894,7 @@ class IPF_ORM_Query extends IPF_ORM_Query_Abstract implements Countable, Seriali } } - 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]; @@ -972,7 +972,7 @@ class IPF_ORM_Query extends IPF_ORM_Query_Abstract implements Countable, Seriali } } - if ($driverName == 'mysql' || $driverName == 'pgsql') { + if ($driverName == 'Mysql' || $driverName == 'Pgsql') { foreach ($parts as $k => $part) { if (strpos($part, "'") !== false) { continue; diff --git a/ipf/orm/utils.php b/ipf/orm/utils.php index 0fa8f93..4eba188 100644 --- a/ipf/orm/utils.php +++ b/ipf/orm/utils.php @@ -15,7 +15,7 @@ class IPF_ORM_Utils { return "active"; break; } - } + } public static function getConnectionAsString(IPF_ORM_Connection $connection) { @@ -24,7 +24,7 @@ class IPF_ORM_Utils { $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[] = ""; return implode("\n",$r)."
"; }