tbl_select.php 2.2 KB

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