SylvainTI / phpliteadmin

Automatically exported from code.google.com/p/phpliteadmin
0 stars 0 forks source link

SQL tab doesn't show `EXPLAIN` results #224

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

1. Choose a database or table.
2. Go to SQL tab
3. Enter `EXPLAIN SELECT 1`

Instead of showing the results, it says "0 file(s) affected".

I am using
* phpLiteAdmin v1.9.4.1 
* PHP 5.4.17
* PDO
* SQLite version 3.7.7.1
* Apache 2.4.6+
* Windows XP SP3

To fix it, both "database SQL editor" and "perform SQL query on table" should 
use

    if(preg_match('/^\s*(?:select|pragma|explain)\s/i', $query[$i])===1)   // pragma and explain often return. rows just like select
    {
        $isSelect = true;
        $result = $db->selectArray($query[$i], "assoc");
    }
    else
    {
        $isSelect = false;
        $result = $db->query($query[$i]);
    }

Note `select|pragma|explain` instead of just `select|pragma`

Original issue reported on code.google.com by Loiroor...@gmail.com on 30 Aug 2013 at 3:11

GoogleCodeExporter commented 9 years ago
Thanks for the report and the proposed solution. Both seem to be correct.

Original comment by crazy4ch...@gmail.com on 30 Aug 2013 at 9:07

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r415.

Original comment by crazy4ch...@gmail.com on 30 Aug 2013 at 9:19

GoogleCodeExporter commented 9 years ago

Original comment by crazy4ch...@gmail.com on 30 Aug 2013 at 9:21

GoogleCodeExporter commented 9 years ago

Original comment by crazy4ch...@gmail.com on 30 Aug 2013 at 9:21