SQL tab doesn't show `EXPLAIN` results

Issue #224 resolved
Former user created an issue

Originally reported on Google Code with ID 224

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`

Reported by Loirooriol on 2013-08-30 03:11:11

Comments (4)

  1. Christopher Kramer
    Thanks for the report and the proposed solution. Both seem to be correct.
    

    Reported by crazy4chrissi on 2013-08-30 09:07:00 - Status changed: Accepted

  2. Christopher Kramer
    This issue was closed by revision r415.
    

    Reported by crazy4chrissi on 2013-08-30 09:19:10 - Status changed: Fixed

  3. Log in to comment