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