00001 <?php
00002
00003
00004
00005
00009 require('./tbl_properties_common.php');
00010 $url_query .= '&goto=tbl_properties_export.php&back=tbl_properties_export.php';
00011 require('./tbl_properties_table_info.php');
00012 ?>
00013
00014 <!-- Dump of a table -->
00015 <?php
00016 $export_page_title = $strViewDump;
00017
00018
00019
00020
00021 if (isset($sql_query)) {
00022
00023 $parsed_sql = PMA_SQP_parse($sql_query);
00024
00025
00026 if (isset($primary_key)) {
00027
00028
00029 $analyzed_sql = PMA_SQP_analyze($parsed_sql);
00030 $sql_query = 'SELECT ';
00031
00032 if (isset($analyzed_sql[0]['queryflags']['distinct'])) {
00033 $sql_query .= ' DISTINCT ';
00034 }
00035
00036 $sql_query .= $analyzed_sql[0]['select_expr_clause'];
00037
00038 if (!empty($analyzed_sql[0]['from_clause'])) {
00039 $sql_query .= ' FROM ' . $analyzed_sql[0]['from_clause'];
00040 }
00041
00042 if (isset($primary_key) && is_array($primary_key)) {
00043 $sql_query .= ' WHERE ';
00044 $conj = '';
00045 foreach ($primary_key AS $i => $key) {
00046 $sql_query .= $conj . '( ' . $key . ' ) ';
00047 $conj = 'OR ';
00048 }
00049 } elseif (!empty($analyzed_sql[0]['where_clause'])) {
00050 $sql_query .= ' WHERE ' . $analyzed_sql[0]['where_clause'];
00051 }
00052 if (!empty($analyzed_sql[0]['group_by_clause'])) {
00053 $sql_query .= ' GROUP BY ' . $analyzed_sql[0]['group_by_clause'];
00054 }
00055 if (!empty($analyzed_sql[0]['having_clause'])) {
00056 $sql_query .= ' HAVING ' . $analyzed_sql[0]['having_clause'];
00057 }
00058 if (!empty($analyzed_sql[0]['order_by_clause'])) {
00059 $sql_query .= ' ORDER BY ' . $analyzed_sql[0]['order_by_clause'];
00060 }
00061 } else {
00062
00063 $inside_bracket = FALSE;
00064 for ($i = $parsed_sql['len'] - 1; $i >= 0; $i--) {
00065 if ($parsed_sql[$i]['type'] == 'punct_bracket_close_round') {
00066 $inside_bracket = TRUE;
00067 continue;
00068 }
00069 if ($parsed_sql[$i]['type'] == 'punct_bracket_open_round') {
00070 $inside_bracket = FALSE;
00071 continue;
00072 }
00073 if (!$inside_bracket && $parsed_sql[$i]['type'] == 'alpha_reservedWord' && strtoupper($parsed_sql[$i]['data']) == 'LIMIT') {
00074
00075
00076 $sql_query = '';
00077
00078
00079 for ($j = 0; $j < $i; $j++) {
00080 $sql_query .= $parsed_sql[$j]['data'] . ' ';
00081 }
00082
00083
00084 $i++;
00085 while ($i < $parsed_sql['len'] &&
00086 ($parsed_sql[$i]['type'] != 'alpha_reservedWord' ||
00087 ($parsed_sql[$i]['type'] == 'alpha_reservedWord' && $parsed_sql[$i]['data'] == 'OFFSET'))) {
00088 $i++;
00089 }
00090
00091
00092 while ($i < $parsed_sql['len']) {
00093 $sql_query .= $parsed_sql[$i]['data'] . ' ';
00094 $i++;
00095 }
00096 break;
00097 }
00098 }
00099 }
00100 $message = $GLOBALS['strSuccess'];
00101 }
00102
00106 require('./tbl_properties_links.php');
00107
00108 $export_type = 'table';
00109 require_once('./libraries/display_export.lib.php');
00110
00111
00115 require_once('./footer.inc.php');
00116 ?>