]> git.andy128k.dev Git - ipf-legacy-orm.git/commitdiff
remove attr DRIVER_NAME
authorAndrey Kutejko <andy128k@gmail.com>
Sat, 8 Jun 2013 18:18:26 +0000 (21:18 +0300)
committerAndrey Kutejko <andy128k@gmail.com>
Sat, 8 Jun 2013 18:18:26 +0000 (21:18 +0300)
ipf/orm.php
ipf/orm/adapter.php
ipf/orm/connection.php
ipf/orm/manager.php
ipf/orm/query.php
ipf/orm/utils.php

index 42a4e9620fcb09ec662fc0013950a31ba78a0f68..797f7935923c860c503c86d5b5455a5763440a67 100644 (file)
@@ -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;
 
index 1ca145acfc721d0ea9f664d35ec2093215e34b91..363cade3a92c5fb8af667d2a51aac694a485a476 100644 (file)
@@ -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;
index 13c2c82aed9c5fbf3f43a6ae301062e111d133e7..7e1cfd822e020b0aaea367e286080360626338a4 100644 (file)
@@ -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])
index 93dfa1372b897fa2c907948af6f5fc3e7eb73363..b32b49dfbe640b377ce20bef87e4cf584234c48f 100644 (file)
@@ -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') {
index 7124026a66db8d8212f94e39b770e03dea22ff82..b087a6daca3d1928819995d19ccaee2be9b09d9b 100644 (file)
@@ -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;
index 0fa8f93c7bf4f86fc2bd72318161aed99d1eb221..4eba1884bd044364161f1b7ff895e8931438e285 100644 (file)
@@ -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[] = "</pre>";
         return implode("\n",$r)."<br>";
     }