SQL delimiter not being ignored inside comments or strings (patch included)

Issue #63 resolved
Joseph Sturtevant created an issue

Originally reported on Google Code with ID 63 ``` What steps will reproduce the problem? 1. Go to the 'SQL' tab. 2. Run the query (with the default delimiter ';'): SELECT 'A;B';

What is the expected output? What do you see instead? The expected output is a single result set with 'A;B'. Instead you get an error since the the statement is split into two (both invalid) statements.

What version of the product are you using? v1.8.8

Please provide any additional information below. The solution (IMO) is to use an implementation of explode that is aware of (and skips) SQL string literals and comments. I have written such a function and its implementation is attached. I have tested it fairly extensively and it seems to work well.

To apply the patch: 1. Copy the body of explode_sql into phpliteadmin.php 2. Replace any calls to explode that are splitting sql with a call to explode_sql. Note: On v1.8.8 these calls are at lines 1969 and 3150. ```

Reported by `sturtevant` on 2011-10-23 04:23:05

<hr>

Comments (1)

  1. Dane Iracleous

    ``` That's a great observation and fix you provided. I included it in v1.8.9, which is now on SVN. ```

    Reported by `diracleo` on 2011-10-23 07:03:58 - Status changed: `Fixed`

  2. Log in to comment