2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Handles table search tab
6 * display table search form, create SQL query from form data
7 * and call PMA_executeQueryAndSendQueryResponse() to execute it
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);
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 .= '&goto=tbl_select.php&back=tbl_select.php';
51 * Gets table's information
53 include_once 'libraries/tbl_info.inc.php';
56 $goto = PMA_Util
::getScriptNameForOption(
57 $GLOBALS['cfg']['DefaultTabTable'], 'table'
60 // Defines the url to return to in case of error in the next sql statement
61 $err_url = $goto . PMA_URL_getCommon(array('db' => $db, 'table' => $table));
62 // Displays the table search form
63 $response->addHTML($table_search->getSecondaryTabs());
64 $response->addHTML($table_search->getSelectionForm($goto));
68 * Selection criteria have been submitted -> do the work
70 $sql_query = $table_search->buildSqlQuery();
73 * Parse and analyze the query
75 include_once 'libraries/parse_analyze.inc.php';
77 PMA_executeQueryAndSendQueryResponse(
78 $analyzed_sql_results, false, $db, $table, null, null, null, false,
79 null, null, null, $GLOBALS['goto'], $pmaThemeImage, null,
80 null, null, $sql_query, null, null