3 // vim: expandtab sw=4 ts=4 sts=4:
5 $GLOBALS['unparsed_sql'] = $sql_query;
6 $parsed_sql = PMA_SQP_parse($sql_query);
7 $analyzed_sql = PMA_SQP_analyze($parsed_sql);
9 // lem9: for bug 780516: now that we use case insensitive preg_match
10 // or flags from the analyser, do not put back the reformatted query
11 // into $sql_query, to make this kind of query work without
12 // capitalizing keywords:
14 // CREATE TABLE SG_Persons (
15 // id int(10) unsigned NOT NULL auto_increment,
16 // first varchar(64) NOT NULL default '',
20 // check for a real SELECT ... FROM
21 $is_select = isset($analyzed_sql[0]['queryflags']['select_from']);
23 // If the query is a Select, extract the db and table names and modify
24 // $db and $table, to have correct page headers, links and left frame.
25 // db and table name may be enclosed with backquotes, db is optionnal,
26 // query may contain aliases.
28 // (TODO: if there are more than one table name in the Select:
29 // - do not extract the first table name
30 // - do not show a table name in the page header
31 // - do not display the sub-pages links)
35 if (isset($analyzed_sql[0]['table_ref'][0]['table_true_name'])) {
36 $table = $analyzed_sql[0]['table_ref'][0]['table_true_name'];
38 if (isset($analyzed_sql[0]['table_ref'][0]['db'])
39 && strlen($analyzed_sql[0]['table_ref'][0]['db'])) {
40 $db = $analyzed_sql[0]['table_ref'][0]['db'];
44 // Nijel: don't change reload, if we already decided to reload in import
46 $reload = ($db == $prev_db) ?
0 : 1;