2
/* $Id: parse_analyze.lib.php 9438 2006-09-21 14:28:46Z cybot_tm $ */
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.
29
* @todo if there are more than one table name in the Select:
30
* - do not extract the first table name
31
* - do not show a table name in the page header
32
* - do not display the sub-pages links)
36
if (isset($analyzed_sql[0]['table_ref'][0]['table_true_name'])) {
37
$table = $analyzed_sql[0]['table_ref'][0]['table_true_name'];
39
if (isset($analyzed_sql[0]['table_ref'][0]['db'])
40
&& strlen($analyzed_sql[0]['table_ref'][0]['db'])) {
41
$db = $analyzed_sql[0]['table_ref'][0]['db'];
45
// Nijel: don't change reload, if we already decided to reload in import
47
$reload = ($db == $prev_db) ? 0 : 1;