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

svn at limb-project.com svn at limb-project.com
Mon Apr 14 14:50:10 MSD 2008


Author: pachanga
Date: 2008-04-14 14:50:09 +0400 (Mon, 14 Apr 2008)
New Revision: 6928
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6928

Modified:
   3.x/trunk/limb/dbal/src/drivers/sqlite/lmbSqliteManipulationStatement.class.php
Log:
-- making where check a little less fragile(but it still sucks anyway)

Modified: 3.x/trunk/limb/dbal/src/drivers/sqlite/lmbSqliteManipulationStatement.class.php
===================================================================
--- 3.x/trunk/limb/dbal/src/drivers/sqlite/lmbSqliteManipulationStatement.class.php	2008-04-14 09:54:20 UTC (rev 6927)
+++ 3.x/trunk/limb/dbal/src/drivers/sqlite/lmbSqliteManipulationStatement.class.php	2008-04-14 10:50:09 UTC (rev 6928)
@@ -27,10 +27,11 @@
   {
     $sql = ltrim($this->getSQL());
 
+    //TODO: make it less fragile
     //this is a dirty hack for sqlite_changes which
-    //doesn't return proper value if there was not
-    if((stripos($sql, 'delete ') === 0 || stripos($sql, 'update '))
-       && stripos($sql, ' where ') === false)
+    //doesn't return proper value if there was no where condition
+    if((stripos($sql, 'delete ') === 0 || stripos($sql, 'update ') === 0)
+       && !preg_match('~\swhere\s~i', $sql))
       $sql .= " WHERE 1=1";
 
     return (bool)$this->connection->execute($sql);



More information about the limb-svn mailing list