• R/O
  • HTTP
  • SSH
  • HTTPS

nucleus-plugins: Commit

Nucleus CMS日本語版用プラグインのうち、日本語版開発者がサポートしているもの


Commit MetaInfo

Revision09d3c38203cb77de2b5d94721dc9250b213cba38 (tree)
Time2009-04-24 06:48:47
Authorkmorimatsu <kmorimatsu@1ca2...>
Commiterkmorimatsu

Log Message

Debug: MySQL specific comment, '--'

git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@1011 1ca29b6e-896d-4ea0-84a5-967f57386b96

Change Summary

Incremental Difference

--- a/sqlite/trunk/nucleus/sqlite/sqlite.php
+++ b/sqlite/trunk/nucleus/sqlite/sqlite.php
@@ -271,21 +271,27 @@ function sqlite_changeQuote(&$query){
271271 $ret='';
272272 $qlen=strlen($query);
273273 for ($i=0;$i<$qlen;$i++) {
274+ // Check MySQL specific comment, '--'.
275+ $temp=substr($query,$i);
276+ if (preg_match('/^([^"`\']*)[\r\n]\-\-[\s^\r\n][^\r\n]*/',$temp,$m)) {
277+ // Found.
278+ $ret.=preg_replace('/[\s]+/',' ',$m[1]); // Change all spacing to ' '.
279+ $i += strlen($m[0]);
280+ continue;
281+ }
274282 // Go to next quote
275283 if (($i1=strpos($query,'"',$i))===false) $i1=$qlen;
276284 if (($i2=strpos($query,"'",$i))===false) $i2=$qlen;
277285 if (($i3=strpos($query,'`',$i))===false) $i3=$qlen;
278286 if ($i1==$qlen && $i2==$qlen && $i3==$qlen) {
279- $temp=preg_replace('/[\s]+/',' ',substr($query,$i)); // Change all spacying to ' '.
287+ $temp=preg_replace('/[\s]+/',' ',substr($query,$i)); // Change all spacing to ' '.
280288 $ret.=($temp);
281289 if (strstr($temp,';')) exit('Warning: try to use more than two queries?');
282290 break;
283291 }
284292 if ($i2<($j=$i1)) $j=$i2;
285293 if ($i3<$j) $j=$i3;
286- $temp=preg_replace('/[\s]+/',' ',substr($query,$i,$j-$i)); // Change all spacying to ' '.
287- // Remove MySQL specific comment, '-- '.
288- $temp=preg_replace('/($|[\r\n])\-\-[\s^\r\n]([^\r\n]*)/',' ',$temp);
294+ $temp=preg_replace('/[\s]+/',' ',substr($query,$i,$j-$i)); // Change all spacing to ' '.
289295 $ret.=($temp);
290296 $c=$query[($i=$j)]; // $c keeps the type of quote.
291297 if (strstr($temp,';')) exit('Warning: try to use more than two queries?');
Show on old repository browser