Refactored ConfigFile class so that it is no longer a singleton
[phpmyadmin.git] / tbl_select.php
blobf191d592a5a91c42b91d23c9c88ad0658ce32b55
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Handles table search tab
6 * display table search form, create SQL query from form data
7 * and call PMA_executeQueryAndSendQueryResponse() to execute it
9 * @package PhpMyAdmin
12 /**
13 * Gets some core libraries
15 require_once 'libraries/common.inc.php';
16 require_once 'libraries/mysql_charsets.inc.php';
17 require_once 'libraries/TableSearch.class.php';
18 require_once 'libraries/sql.lib.php';
20 $response = PMA_Response::getInstance();
21 $header = $response->getHeader();
22 $scripts = $header->getScripts();
23 $scripts->addFile('makegrid.js');
24 $scripts->addFile('sql.js');
25 $scripts->addFile('tbl_select.js');
26 $scripts->addFile('tbl_change.js');
27 $scripts->addFile('jquery/jquery-ui-timepicker-addon.js');
28 $scripts->addFile('gis_data_editor.js');
30 $table_search = new PMA_TableSearch($db, $table, "normal");
32 /**
33 * No selection criteria received -> display the selection form
35 if (! isset($_POST['columnsToDisplay']) && ! isset($_POST['displayAllColumns'])) {
36 // Gets some core libraries
37 include_once 'libraries/tbl_common.inc.php';
38 //$err_url = 'tbl_select.php' . $err_url;
39 $url_query .= '&amp;goto=tbl_select.php&amp;back=tbl_select.php';
40 /**
41 * Gets table's information
43 include_once 'libraries/tbl_info.inc.php';
45 if (! isset($goto)) {
46 $goto = $GLOBALS['cfg']['DefaultTabTable'];
48 // Defines the url to return to in case of error in the next sql statement
49 $err_url = $goto . '?' . PMA_URL_getCommon($db, $table);
50 // Displays the table search form
51 $response->addHTML($table_search->getSecondaryTabs());
52 $response->addHTML($table_search->getSelectionForm($goto));
54 } else {
55 /**
56 * Selection criteria have been submitted -> do the work
58 $sql_query = $table_search->buildSqlQuery();
60 /**
61 * Parse and analyze the query
63 include_once 'libraries/parse_analyze.inc.php';
65 PMA_executeQueryAndSendQueryResponse(
66 $analyzed_sql_results, false, $db, $table, null, null, null, false, null,
67 null, null, null, $goto, $pmaThemeImage, null, null, null, $sql_query,
68 null, null