Closed GoogleCodeExporter closed 9 years ago
I've done a temporary patch into my code.
$sql = 'SELECT
name, 1, test;'
$parser = new PHPSQLParser($sql); // Fail
$sql = preg_replace('/^(SELECT)(\s)(\s+)/si', '$1 ', $sql);
$parser = new PHPSQLParser($sql); // Success
Original comment by johnny.c...@gmail.com
on 14 Dec 2010 at 4:37
i did it in "split_sql($sql)"
change
$sql = str_replace(array('\\\'','\\"'),array("''",'""'), $sql)
to
$sql = str_replace(array("\n","\r",'\\\'','\\"'),array(' ',' ',"''",'""'),
$sql);
Original comment by patrik.p...@gmail.com
on 17 Jan 2011 at 8:08
here is a diff which
* makes the reserved and functions array static (results in faster parsing)
* newlines are being replaced with ' ' before parse;
* the sql syntax regarding fulltext i.e. 'match mycol against ('+*foobar*' IN
BOOLEAN MODE)' is handled better (at least for my needs)
regards
Patrik
Original comment by patrik.p...@gmail.com
on 17 Jan 2011 at 9:58
Attachments:
Thank, I will patch my own version and try it.
Original comment by johnny.c...@gmail.com
on 17 Jan 2011 at 11:58
Thanks for the report - I'll review and incorporate your changes.
Original comment by greenlion@gmail.com
on 4 Feb 2011 at 8:42
Thanks again for your contribution.
I incorporated your match/against improvement. I had already made a newline
fix.
I have not yet switched to static arrays.
I updated the t/select.php test.
Original comment by greenlion@gmail.com
on 21 Mar 2011 at 7:27
Original issue reported on code.google.com by
johnny.c...@gmail.com
on 14 Dec 2010 at 4:06