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';
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");
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 .= '&goto=tbl_select.php&back=tbl_select.php';
41 * Gets table's information
43 include_once 'libraries/tbl_info.inc.php';
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_generate_common_url($db, $table);
50 // Displays the table search form
51 $response->addHTML($table_search->getSecondaryTabs());
52 $response->addHTML($table_search->getSelectionForm($goto));
56 * Selection criteria have been submitted -> do the work
58 $sql_query = $table_search->buildSqlQuery();
61 * Parse and analyze the query
63 require_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,