OSDN Git Service

SQLite: support using '-- ' as comment.
authorkmorimatsu <kmorimatsu@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Tue, 17 Mar 2009 19:57:55 +0000 (19:57 +0000)
committerkmorimatsu <kmorimatsu@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Tue, 17 Mar 2009 19:57:55 +0000 (19:57 +0000)
git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@986 1ca29b6e-896d-4ea0-84a5-967f57386b96

sqlite/trunk/nucleus/sqlite/sqlite.php

index 271bdb9..3ce66cc 100644 (file)
@@ -1,7 +1,7 @@
 <?php\r
     /****************************************\r
     * SQLite-MySQL wrapper for Nucleus      *\r
 <?php\r
     /****************************************\r
     * SQLite-MySQL wrapper for Nucleus      *\r
-    *                           ver 0.9.0.4 *\r
+    *                           ver 0.9.0.5 *\r
     * Written by Katsumi                    *\r
     ****************************************/\r
 \r
     * Written by Katsumi                    *\r
     ****************************************/\r
 \r
@@ -13,7 +13,7 @@ if (!function_exists('sqlite_open')) exit('Sorry, SQLite is not available from P
 require_once dirname(__FILE__) . '/sqliteconfig.php';\r
 $SQLITE_DBHANDLE=sqlite_open($SQLITECONF['DBFILENAME']);\r
 require_once dirname(__FILE__) . '/sqlitequeryfunctions.php';\r
 require_once dirname(__FILE__) . '/sqliteconfig.php';\r
 $SQLITE_DBHANDLE=sqlite_open($SQLITECONF['DBFILENAME']);\r
 require_once dirname(__FILE__) . '/sqlitequeryfunctions.php';\r
-$SQLITECONF['VERSION']='0.9.0.4';\r
+$SQLITECONF['VERSION']='0.9.0.5';\r
 \r
 //Following thing may work if MySQL is NOT installed in server.\r
 if (!function_exists('mysql_query')) {\r
 \r
 //Following thing may work if MySQL is NOT installed in server.\r
 if (!function_exists('mysql_query')) {\r
@@ -111,6 +111,9 @@ 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
        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
        // 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