Converting number of Excel column names no longer limited
[phpmyadmin/arisferyanto.git] / tbl_export.php
blob11df4b6f1bd08e1fa1e57134f2f964118d75b900
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 * @package phpMyAdmin
7 */
9 /**
12 require_once './libraries/common.inc.php';
14 /**
15 * Gets tables informations and displays top links
17 require_once './libraries/tbl_common.php';
18 $url_query .= '&amp;goto=tbl_export.php&amp;back=tbl_export.php';
19 require_once './libraries/tbl_info.inc.php';
21 // Dump of a table
23 $export_page_title = $strViewDump;
25 // When we have some query, we need to remove LIMIT from that and possibly
26 // generate WHERE clause (if we are asked to export specific rows)
28 if (! empty($sql_query)) {
29 // Parse query so we can work with tokens
30 $parsed_sql = PMA_SQP_parse($sql_query);
31 $analyzed_sql = PMA_SQP_analyze($parsed_sql);
33 // Need to generate WHERE clause?
34 if (isset($where_clause)) {
35 // Yes => rebuild query from scratch; this doesn't work with nested
36 // selects :-(
37 $sql_query = 'SELECT ';
39 if (isset($analyzed_sql[0]['queryflags']['distinct'])) {
40 $sql_query .= ' DISTINCT ';
43 $sql_query .= $analyzed_sql[0]['select_expr_clause'];
45 if (!empty($analyzed_sql[0]['from_clause'])) {
46 $sql_query .= ' FROM ' . $analyzed_sql[0]['from_clause'];
49 $wheres = array();
51 if (isset($where_clause) && is_array($where_clause)
52 && count($where_clause) > 0) {
53 $wheres[] = '(' . implode(') OR (',$where_clause) . ')';
56 if (!empty($analyzed_sql[0]['where_clause'])) {
57 $wheres[] = $analyzed_sql[0]['where_clause'];
60 if (count($wheres) > 0) {
61 $sql_query .= ' WHERE (' . implode(') AND (', $wheres) . ')';
64 if (!empty($analyzed_sql[0]['group_by_clause'])) {
65 $sql_query .= ' GROUP BY ' . $analyzed_sql[0]['group_by_clause'];
67 if (!empty($analyzed_sql[0]['having_clause'])) {
68 $sql_query .= ' HAVING ' . $analyzed_sql[0]['having_clause'];
70 if (!empty($analyzed_sql[0]['order_by_clause'])) {
71 $sql_query .= ' ORDER BY ' . $analyzed_sql[0]['order_by_clause'];
73 } else {
74 // Just crop LIMIT clause
75 $sql_query = $analyzed_sql[0]['section_before_limit'] . $analyzed_sql[0]['section_after_limit'];
77 $message = PMA_Message::success();
80 /**
81 * Displays top menu links
83 require './libraries/tbl_links.inc.php';
85 $export_type = 'table';
86 require_once './libraries/display_export.lib.php';
89 /**
90 * Displays the footer
92 require_once './libraries/footer.inc.php';