home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / tbl_properties_export.php < prev    next >
Encoding:
PHP Script  |  2003-11-26  |  2.0 KB  |  67 lines

  1. <?php
  2. /* $Id: tbl_properties_export.php,v 2.2 2003/11/26 22:52:24 rabus Exp $ */
  3. // vim: expandtab sw=4 ts=4 sts=4:
  4.  
  5.  
  6. /**
  7.  * Gets tables informations and displays top links
  8.  */
  9. require('./tbl_properties_common.php');
  10. $url_query .= '&goto=tbl_properties_export.php&back=tbl_properties_export.php';
  11. require('./tbl_properties_table_info.php');
  12. ?>
  13.  
  14. <!-- Dump of a table -->
  15. <h2>
  16.     <?php echo $strViewDump . "\n"; ?>
  17. </h2>
  18.  
  19. <?php
  20. if (isset($sql_query)) {
  21.     // I don't want the LIMIT clause, so I use the analyzer
  22.     // to reconstruct the query with only some parts
  23.     // because the LIMIT clause may come from us (sql.php, sql_limit_to_append
  24.     // or may come from the user.
  25.     // Then, the limits set in the form will be added.
  26.     // TODO: do we need some other parts here, like PROCEDURE or FOR UPDATE?
  27.  
  28.     $parsed_sql = PMA_SQP_parse($sql_query);
  29.     $analyzed_sql = PMA_SQP_analyze($parsed_sql);
  30.     $sql_query = 'SELECT ';
  31.  
  32.     if (isset($analyzed_sql[0]['queryflags']['distinct'])) {
  33.         $sql_query .= ' DISTINCT ';
  34.     }
  35.  
  36.     $sql_query .= $analyzed_sql[0]['select_expr_clause'];
  37.  
  38.     if (!empty($analyzed_sql[0]['from_clause'])) {
  39.         $sql_query .= ' FROM ' . $analyzed_sql[0]['from_clause'];
  40.     }
  41.     if (!empty($analyzed_sql[0]['where_clause'])) {
  42.         $sql_query .= ' WHERE ' . $analyzed_sql[0]['where_clause'];
  43.     }
  44.     if (!empty($analyzed_sql[0]['group_by_clause'])) {
  45.         $sql_query .= ' GROUP BY ' . $analyzed_sql[0]['group_by_clause'];
  46.     }
  47.     if (!empty($analyzed_sql[0]['having_clause'])) {
  48.         $sql_query .= ' HAVING ' . $analyzed_sql[0]['having_clause'];
  49.     }
  50.     if (!empty($analyzed_sql[0]['order_by_clause'])) {
  51.         $sql_query .= ' ORDER BY ' . $analyzed_sql[0]['order_by_clause'];
  52.     }
  53.  
  54.     // TODO: can we avoid reparsing the query here?
  55.     PMA_showMessage($GLOBALS['strSQLQuery']);
  56. }
  57.  
  58. $export_type = 'table';
  59. require_once('./libraries/display_export.lib.php');
  60.  
  61.  
  62. /**
  63.  * Displays the footer
  64.  */
  65. require_once('./footer.inc.php');
  66. ?>
  67.