OSDN Git Service

sqlite: debug, MySQL-specific comment, '-- '.
authorkmorimatsu <kmorimatsu@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Thu, 19 Mar 2009 23:25:34 +0000 (23:25 +0000)
committerkmorimatsu <kmorimatsu@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Thu, 19 Mar 2009 23:25:34 +0000 (23:25 +0000)
git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@989 1ca29b6e-896d-4ea0-84a5-967f57386b96

sqlite/trunk/nucleus/sqlite/sqlite.php

index 3ce66cc..e53cf02 100644 (file)
@@ -111,9 +111,6 @@ function nucleus_mysql_query($p1,$p2=null,$unbuffered=false){//echo htmlspecialc
        if (strpos($query,"\xEF\xBB\xBF")===0) $query=substr($query,3);// UTF-8 stuff\r
        if (substr($query,-1)==';') $query=substr($query,0,strlen($query)-1);\r
        \r
-       // Remove MySQL specific comment, '-- '.\r
-       $query=preg_replace('/($|[\r\n])\-\-[\s^\r\n]([^\r\n]*)/','',$query);\r
-       \r
        // Escape style is changed from MySQL type to SQLite type here.\r
        // This is important to avoid possible SQL-injection.\r
        $strpositions=array();// contains the data show where the strings are (startposition => endposition)\r
@@ -287,6 +284,8 @@ function sqlite_changeQuote(&$query){
                if ($i2<($j=$i1)) $j=$i2;\r
                if ($i3<$j) $j=$i3;\r
                $temp=preg_replace('/[\s]+/',' ',substr($query,$i,$j-$i)); // Change all spacying to ' '.\r
+               // Remove MySQL specific comment, '-- '.\r
+               $temp=preg_replace('/($|[\r\n])\-\-[\s^\r\n]([^\r\n]*)/',' ',$temp);\r
                $ret.=($temp);\r
                $c=$query[($i=$j)]; // $c keeps the type of quote.\r
                if (strstr($temp,';')) exit('Warning: try to use more than two queries?');\r