3 // vim: expandtab sw=4 ts=4 sts=4:
7 * Gets tables informations and displays top links
9 require('./tbl_properties_common.php3');
10 $url_query .= '&goto=tbl_properties_export.php3&back=tbl_properties_export.php3';
11 require('./tbl_properties_table_info.php3');
14 <!-- Dump of a table
-->
16 <?php
echo $strViewDump . "\n"; ?
>
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.php3, 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?
28 $parsed_sql = PMA_SQP_parse($sql_query);
29 $analyzed_sql = PMA_SQP_analyze($parsed_sql);
30 $sql_query = 'SELECT ' . $analyzed_sql[0]['select_expr_clause'];
32 if (!empty($analyzed_sql[0]['from_clause'])) {
33 $sql_query .= ' FROM ' . $analyzed_sql[0]['from_clause'];
35 if (!empty($analyzed_sql[0]['where_clause'])) {
36 $sql_query .= ' WHERE ' . $analyzed_sql[0]['where_clause'];
38 if (!empty($analyzed_sql[0]['group_by_clause'])) {
39 $sql_query .= ' GROUP BY ' . $analyzed_sql[0]['group_by_clause'];
41 if (!empty($analyzed_sql[0]['having_clause'])) {
42 $sql_query .= ' HAVING ' . $analyzed_sql[0]['having_clause'];
44 if (!empty($analyzed_sql[0]['order_by_clause'])) {
45 $sql_query .= ' ORDER BY ' . $analyzed_sql[0]['order_by_clause'];
48 // TODO: can we avoid reparsing the query here?
49 PMA_showMessage($GLOBALS['strSQLQuery']);
52 <form method
="post" action
="tbl_dump.php3" name
="tbl_dump">
54 echo ' ' . PMA_generate_common_hidden_inputs($db, $table);
55 if (isset($sql_query)) {
56 echo ' <input type="hidden" name="sql_query" value="' . urlencode($sql_query) . '" />';
60 <script type
="text/javascript">
63 d
=document
;l
=(d
.layers
)?
1:0;op
=navigator
.userAgent
.toLowerCase().indexOf('opera')!=-1;
64 /* Get Element */ function gE(e
,f
){if(l
){f
=(f
)?f
:self
;V
=f
.document
.layers
;if(V
[e
])return V
[e
];for(W
=0;i
<W
.length
;W++
)return(gE(e
,V
[W
]));}if(d
.all
)return d
.all
[e
];return d
.getElementById(e
);}
65 /* Show Element */ function sE(e
){if(l
)e
.visibility
='show';else e
.style
.visibility
='visible';}
66 /* Hide Element */ function hE(e
){if(l
)e
.visibility
='hide';else e
.style
.visibility
='hidden';}
67 /* Set Position X */ function sX(e
,x
){if(l
)e
.left
=x
;else if(op
)e
.style
.pixelLeft
=x
;else e
.style
.left
=x+
'px';}
68 /* Get Position X */ function gX(e
){if(l
)return e
.left
;else if(op
)return e
.style
.pixelLeft
;else return parseInt(e
.style
.left
);}
69 /* Set Position Y */ function sY(e
,y
){if(l
)e
.top
=y
;else if(op
)e
.style
.pixelTop
=y
;else e
.style
.top
=y+
'px';}
70 /* Get Position Y */ function gY(e
){if(l
)return e
.top
;else if(op
)return e
.style
.pixelTop
;else return parseInt(e
.style
.top
);}
71 /* Set Width */ function sW(e
,w
){if(l
)e
.clip
.width
=w
;else if(op
)e
.style
.pixelWidth
=w
;else e
.style
.width
=w
;}
72 /* Get Width */ function gW(e
){if(l
)return e
.clip
.width
;else if(op
)return e
.style
.pixelWidth
;else return parseInt(e
.style
.width
);}
73 /* Set Height */ function sH(e
,h
){if(l
)e
.clip
.height
=h
;else if(op
)e
.style
.pixelHeight
=h
;else e
.style
.height
=h
;}
74 /* Get Height */ function gH(e
){if(l
)return e
.clip
.height
;else if(op
)return e
.style
.pixelHeight
;else return parseInt(e
.style
.height
);}
75 /* Write h to e */ function wH(e
,h
){if(l
){Y
=e
.document
;Y
.write(h
);Y
.close();}if(e
.innerHTML
)e
.innerHTML
=h
;}
77 function hide_them_all() {
78 gE("csv_options").style
.display
= 'none';
79 gE("sql_options").style
.display
= 'none';
80 gE("none_options").style
.display
= 'none';
85 <table cellpadding
="5" border
="0" cellspacing
="0" align
="center">
88 <!-- Formats to export to
-->
89 <td nowrap
="nowrap" valign
="top">
90 <fieldset style
="height: 220px;">
91 <legend
><?php
echo $strExport; ?
></legend
>
94 <input type
="radio" name
="what" value
="sql" id
="radio_dump_sql" checked
="checked" onclick
="if(this.checked) { hide_them_all(); gE('sql_options').style.display = 'block'; }; return true" />
95 <label
for="radio_dump_sql"><?php
echo $strSQL; ?
></label
>
99 <input type
="radio" name
="what" value
="latex" id
="radio_dump_latex" onclick
="if(this.checked) { hide_them_all(); gE('none_options').style.display = 'block'; }; return true" />
100 <label
for="radio_dump_latex"><?php
echo $strLaTeX; ?
></label
>
101 <!-- for now we have only one environment supported
-->
104 <select name="environment">
105 <option value="longtable" selected><?php echo $strLaTeXMultipageTable; ?></option>
106 <option value="sideways"><?php echo $strLaTeXSidewaysTable; ?></option>
107 <option value="table"><?php echo $strLaTeXStandardTable; ?></option>
111 <input type
="hidden" name
="environment" value
="longtable" />
115 <input type
="radio" name
="what" value
="excel" id
="radio_dump_excel" onclick
="if(this.checked) { hide_them_all(); gE('none_options').style.display = 'block'; }; return true" />
116 <label
for="radio_dump_excel"><?php
echo $strStrucExcelCSV; ?
></label
>
119 <input type
="radio" name
="what" value
="csv" id
="radio_dump_csv" onclick
="if(this.checked) { hide_them_all(); gE('csv_options').style.display = 'block'; }; return true" />
120 <label
for="radio_dump_csv"><?php
echo $strStrucCSV;?
></label
>
123 <input type
="radio" name
="what" value
="xml" id
="radio_dump_xml" onclick
="if(this.checked) { hide_them_all(); gE('none_options').style.display = 'block'; }; return true" />
124 <label
for="radio_dump_xml"><?php
echo $strXML; ?
></label
> 
; 
;
128 <td valign
="top" id
="options_td" width
="400">
129 <fieldset id
="sql_options">
130 <legend
><?php
echo $strSQLOptions; ?
> (<a href
="./Documentation.html#faqexport" target
="documentation"><?php
echo $strDocu; ?
></a
>)</legend
>
132 <!-- For structure
-->
135 <input type
="checkbox" name
="sql_structure" value
="structure" id
="checkbox_sql_structure" checked
="checked" onclick
="if(!this.checked && !gE('checkbox_sql_data').checked) return false; else return true;" />
136 <label
for="checkbox_sql_structure"><?php
echo $strStructure; ?
></label
><br
/>
138 <input type
="checkbox" name
="drop" value
="1" id
="checkbox_dump_drop" />
139 <label
for="checkbox_dump_drop"><?php
echo $strStrucDrop; ?
></label
><br
/>
141 // Add backquotes checkbox
142 if (PMA_MYSQL_INT_VERSION
>= 32306) {
144 <input type
="checkbox" name
="use_backquotes" value
="1" id
="checkbox_dump_use_backquotes" checked
="checked" />
145 <label
for="checkbox_dump_use_backquotes"><?php
echo $strUseBackquotes; ?
></label
><br
/>
147 } // end backquotes feature
150 // garvin: whether to show column comments
151 require('./libraries/relation.lib.php3');
152 $cfgRelation = PMA_getRelationsParam();
154 if ($cfgRelation['commwork']) {
156 <input type
="checkbox" name
="use_comments" value
="1" id
="checkbox_dump_use_comments" />
157 <label
for="checkbox_dump_use_comments"><?php
echo $strDumpComments; ?
></label
><br
/>
159 } // end dump comments
167 <input type
="checkbox" name
="sql_data" value
="data" id
="checkbox_sql_data" checked
="checked" onclick
="if(!this.checked && !gE('checkbox_sql_structure').checked) return false; else return true;" />
168 <label
for="checkbox_sql_data"><?php
echo $strData; ?
></label
><br
/>
170 <input type
="checkbox" name
="showcolumns" value
="yes" id
="checkbox_dump_showcolumns" />
171 <label
for="checkbox_dump_showcolumns"><?php
echo $strCompleteInserts; ?
></label
><br
/>
172 <input type
="checkbox" name
="extended_ins" value
="yes" id
="checkbox_dump_extended_ins" />
173 <label
for="checkbox_dump_extended_ins"><?php
echo $strExtendedInserts; ?
></label
><br
/>
176 <fieldset id
="csv_options">
177 <legend
><?php
echo $strCSVOptions; ?
></legend
>
178 <table border
="0" cellspacing
="1" cellpadding
="0">
181 <?php
echo $strFieldsTerminatedBy; ?
> 
;
184 <input type
="text" name
="separator" size
="2" value
=";" class="textfield" />
189 <?php
echo $strFieldsEnclosedBy; ?
> 
;
192 <input type
="text" name
="enclosed" size
="2" value
=""" class="textfield" />
197 <?php
echo $strFieldsEscapedBy; ?
> 
;
200 <input type
="text" name
="escaped" size
="2" value
="\" class="textfield
" />
205 <?php echo $strFieldsTerminatedBy; ?>
208 <input type="text
" name="add_character
" size="2" value="<?php
echo ((PMA_whichCrlf() == "\n") ?
'\n' : '\r\n'); ?
>" class="textfield
" />
212 <input type="checkbox
" name="showcsvnames
" value="yes
" id="checkbox_dump_showcsvnames
" />
213 <label for="checkbox_dump_showcsvnames
"><?php echo $strPutColNames; ?></label>
215 <fieldset id="none_options
">
216 <legend><?php echo $strNoOptions; ?></legend>
218 <script type="text
/javascript
">
220 gE('csv_options').style.display = 'none';
221 gE('sql_options').style.display = 'none';
222 gE('none_options').style.display = 'none';
223 if (document.getElementById('radio_dump_sql').checked) {
224 gE('sql_options').style.display = 'block';
225 } else if (document.getElementById('radio_dump_csv').checked) {
226 gE('csv_options').style.display = 'block';
228 gE('none_options').style.display = 'block';
236 <td colspan="2" align="center
">
238 <?php echo sprintf($strDumpXRows , '<input type="text
" name="limit_to
" size="5" value="' . (isset($unlim_num_rows)?$unlim_num_rows: PMA_countRecords($db, $table, TRUE)) . '" class="textfield
" style="vertical
-align
: middle
" onfocus="this
.select()" />' , '<input type="text
" name="limit_from
" value="0" size="5" class="textfield
" style="vertical
-align
: middle
" onfocus="this
.select()" />') . "\n
"; ?>
244 <!-- Export to screen or to file -->
248 <input type="checkbox
" name="asfile
" value="sendit
" id="checkbox_dump_asfile
" />
249 <label for="checkbox_dump_asfile
"><?php echo $strSend; ?></label>
254 if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
255 echo '<label for="select_charset_of_file
">' . $strCharsetOfFile . '</label>';
258 $temp_charset = reset($cfg['AvailableCharsets']);
259 echo '<select id="select_charset_of_file
" name="charset_of_file
" size="1">' . "\n
"
260 . ' <option value="' . $temp_charset . '"';
261 if ($temp_charset == $charset) {
262 echo ' selected="selected
"';
264 echo '>' . $temp_charset . '</option>' . "\n
";
265 while ($temp_charset = next($cfg['AvailableCharsets'])) {
266 echo ' <option value="' . $temp_charset . '"';
267 if ($temp_charset == $charset) {
268 echo ' selected="selected
"';
270 echo '>' . $temp_charset . '</option>' . "\n
";
278 <legend><?php echo $strCompression; ?></legend>
280 <input type="radio
" name="compression
" value="none
" id="radio_compression_none
" checked="checked
" />
281 <label for="radio_compression_none
"><?php echo $strNone; ?></label>
285 // zip, gzip and bzip2 encode features
286 if (PMA_PHP_INT_VERSION >= 40004) {
287 $is_zip = (isset($cfg['ZipDump']) && $cfg['ZipDump'] && @function_exists('gzcompress'));
288 $is_gzip = (isset($cfg['GZipDump']) && $cfg['GZipDump'] && @function_exists('gzencode'));
289 $is_bzip = (isset($cfg['BZipDump']) && $cfg['BZipDump'] && @function_exists('bzcompress'));
290 if ($is_zip || $is_gzip || $is_bzip) {
293 <input type="radio
" name="compression
" value="zip
" id="radio_compression_zip
" />
294 <label for="radio_compression_zip
"><?php echo $strZip; ?></label><?php echo (($is_gzip || $is_bzip) ? ' ' : ''); ?>
300 <input type="radio
" name="compression
" value="gzip
" id="radio_compression_gzip
" />
301 <label for="radio_compression_gzip
"><?php echo $strGzip; ?></label><?php echo ($is_bzip ? ' ' : ''); ?>
307 <input type="radio
" name="compression
" value="bzip
" id="radio_compression_bzip
" />
308 <label for="radio_compression_bzip
"><?php echo $strBzip; ?></label>
320 // Encoding setting form appended by Y.Kawada
321 if (function_exists('PMA_set_enc_form')) {
324 <!-- Japanese encoding setting -->
325 <td colspan="2" align="center
">
327 echo PMA_set_enc_form(' ');
336 <td colspan="2" align="center
">
337 <input type="submit
" value="<?php
echo $strGo; ?
>" />
345 * Displays the footer
347 require('./footer.inc.php3');