Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / phpmyadmin / libraries / parse_analyze.lib.php
blob9b9c800682197636c226d31a34b8da29722db5bd
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Parse and analyse a SQL query
6 * @package PhpMyAdmin
7 */
8 if (! defined('PHPMYADMIN')) {
9 exit;
12 /**
15 $GLOBALS['unparsed_sql'] = $sql_query;
16 $parsed_sql = PMA_SQP_parse($sql_query);
17 $analyzed_sql = PMA_SQP_analyze($parsed_sql);
19 // for bug 780516: now that we use case insensitive preg_match
20 // or flags from the analyser, do not put back the reformatted query
21 // into $sql_query, to make this kind of query work without
22 // capitalizing keywords:
24 // CREATE TABLE SG_Persons (
25 // id int(10) unsigned NOT NULL auto_increment,
26 // first varchar(64) NOT NULL default '',
27 // PRIMARY KEY (`id`)
28 // )
30 // check for a real SELECT ... FROM
31 $is_select = isset($analyzed_sql[0]['queryflags']['select_from']);
33 // If the query is a Select, extract the db and table names and modify
34 // $db and $table, to have correct page headers, links and left frame.
35 // db and table name may be enclosed with backquotes, db is optionnal,
36 // query may contain aliases.
38 /**
39 * @todo if there are more than one table name in the Select:
40 * - do not extract the first table name
41 * - do not show a table name in the page header
42 * - do not display the sub-pages links)
44 if ($is_select) {
45 $prev_db = $db;
46 if (isset($analyzed_sql[0]['table_ref'][0]['table_true_name'])) {
47 $table = $analyzed_sql[0]['table_ref'][0]['table_true_name'];
49 if (isset($analyzed_sql[0]['table_ref'][0]['db'])
50 && strlen($analyzed_sql[0]['table_ref'][0]['db'])
51 ) {
52 $db = $analyzed_sql[0]['table_ref'][0]['db'];
53 } else {
54 $db = $prev_db;
56 // Nijel: don't change reload, if we already decided to reload in import
57 if (empty($reload) && empty($GLOBALS['is_ajax_request'])) {
58 $reload = ($db == $prev_db) ? 0 : 1;