[limb-svn] r5961 - 3.x/trunk/limb/dbal/src/drivers/sqlite

svn at limb-project.com svn at limb-project.com
Fri Jun 8 01:48:54 MSD 2007


Author: pachanga
Date: 2007-06-08 01:48:53 +0400 (Fri, 08 Jun 2007)
New Revision: 5961
URL: http://fisheye.limb-project.com/changelog/limb/?cs=5961

Modified:
   3.x/trunk/limb/dbal/src/drivers/sqlite/lmbSqliteConnection.class.php
Log:
-- all sqlite tests except meta data tests do pass

Modified: 3.x/trunk/limb/dbal/src/drivers/sqlite/lmbSqliteConnection.class.php
===================================================================
--- 3.x/trunk/limb/dbal/src/drivers/sqlite/lmbSqliteConnection.class.php	2007-06-07 14:54:47 UTC (rev 5960)
+++ 3.x/trunk/limb/dbal/src/drivers/sqlite/lmbSqliteConnection.class.php	2007-06-07 21:48:53 UTC (rev 5961)
@@ -14,6 +14,7 @@
 lmb_require(dirname(__FILE__) . '/lmbSqliteManipulationStatement.class.php');
 lmb_require(dirname(__FILE__) . '/lmbSqliteStatement.class.php');
 lmb_require(dirname(__FILE__) . '/lmbSqliteTypeInfo.class.php');
+lmb_require(dirname(__FILE__) . '/lmbSqliteRecord.class.php');
 
 /**
  * class lmbSqliteConnection.
@@ -38,7 +39,7 @@
 
   function getConnectionId()
   {
-    if(!isset($this->connectionId))
+    if(!is_resource($this->connectionId))
       $this->connect();
     
     return $this->connectionId;
@@ -64,7 +65,7 @@
 
   function disconnect()
   {
-    if($this->connectionId)
+    if(is_resource($this->connectionId))
     {      
       sqlite_close($this->connectionId);
       $this->connectionId = null;
@@ -91,9 +92,8 @@
   {
     $result = sqlite_query($this->getConnectionId(), $sql);
     if($result === false)
-    {
       $this->_raiseError($sql);
-    }
+    
     return $result;
   }
 
@@ -115,13 +115,10 @@
   function newStatement($sql)
   {
     if(preg_match('/^\s*\(*\s*(\w+).*$/m', $sql, $match))
-    {
       $statement = $match[1];
-    }
     else
-    {
       $statement = $sql;
-    }
+      
     switch(strtoupper($statement))
     {
       case 'SELECT':
@@ -144,7 +141,6 @@
     return new lmbSqliteTypeInfo();
   }
 
-
   function getDatabaseInfo()
   {
     return new lmbSqliteDbInfo($this, $this->config['database'], true);
@@ -152,13 +148,12 @@
 
   function quoteIdentifier($id)
   {
-    if(!$id)
-      return '';
+    if(!$id) return '';
 
     $pieces = explode('.', $id);
-    $quoted = "'" . $pieces[0] . "'";
+    $quoted = '"' . $pieces[0] . '"';
     if(isset($pieces[1]))
-       $quoted .= ".'" . $pieces[1] . "'";
+       $quoted .= '."' . $pieces[1] . '"';
     return $quoted;
   }
 



More information about the limb-svn mailing list