Ticket was moved to bugs
[phpmyadmin.git] / tbl_select.php
blob93ed5789a45c3ddcb3f339b8521ac2b64771d8d6
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';
19 require_once 'libraries/bookmark.lib.php';
21 $response = PMA_Response::getInstance();
22 $header = $response->getHeader();
23 $scripts = $header->getScripts();
24 $scripts->addFile('makegrid.js');
25 $scripts->addFile('sql.js');
26 $scripts->addFile('tbl_select.js');
27 $scripts->addFile('tbl_change.js');
28 $scripts->addFile('jquery/jquery-ui-timepicker-addon.js');
29 $scripts->addFile('jquery/jquery.uitablefilter.js');
30 $scripts->addFile('gis_data_editor.js');
32 $table_search = new PMA_TableSearch($db, $table, "normal");
34 // Request to column min-max value.
35 if (isset($_REQUEST['range_search'])) {
36 $response = PMA_Response::getInstance();
37 $min_max = $table_search->getColumnMinMax($_REQUEST['column']);
38 $response->addJSON('column_data', $min_max);
39 exit;
42 /**
43 * No selection criteria received -> display the selection form
45 if (! isset($_POST['columnsToDisplay']) && ! isset($_POST['displayAllColumns'])) {
46 // Gets some core libraries
47 include_once 'libraries/tbl_common.inc.php';
48 //$err_url = 'tbl_select.php' . $err_url;
49 $url_query .= '&amp;goto=tbl_select.php&amp;back=tbl_select.php';
50 /**
51 * Gets table's information
53 include_once 'libraries/tbl_info.inc.php';
55 if (! isset($goto)) {
56 $goto = $GLOBALS['cfg']['DefaultTabTable'];
58 // Defines the url to return to in case of error in the next sql statement
59 $err_url = $goto . PMA_URL_getCommon(array('db' => $db, 'table' => $table));
60 // Displays the table search form
61 $response->addHTML($table_search->getSecondaryTabs());
62 $response->addHTML($table_search->getSelectionForm($goto));
64 } else {
65 /**
66 * Selection criteria have been submitted -> do the work
68 $sql_query = $table_search->buildSqlQuery();
70 /**
71 * Parse and analyze the query
73 include_once 'libraries/parse_analyze.inc.php';
75 PMA_executeQueryAndSendQueryResponse(
76 $analyzed_sql_results, false, $db, $table, null, null, null, false,
77 null, null, null, $GLOBALS['goto'], $pmaThemeImage, null,
78 null, null, $sql_query, null, null