From c74a33e5675c9e25c0d4e5d6639fdabcfe15c8e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Chapeaux?= Date: Fri, 13 Jul 2001 17:18:11 +0000 Subject: [PATCH] Added a limitation feature for data dumps thanks to Girish Nair and Vinay --- ChangeLog | 7 +- lang/brazilian_portuguese.inc.php3 | 2 + lang/bulgarian-win1251.inc.php3 | 2 + lang/catala.inc.php3 | 2 + lang/chinese_big5.inc.php3 | 2 + lang/chinese_gb.inc.php3 | 2 + lang/czech-iso.inc.php3 | 2 + lang/czech-win1250.inc.php3 | 2 + lang/danish.inc.php3 | 2 + lang/dutch.inc.php3 | 2 + lang/english.inc.php3 | 13 +- lang/french.inc.php3 | 2 + lang/german.inc.php3 | 2 + lang/italian.inc.php3 | 2 + lang/japanese.inc.php3 | 2 + lang/korean.inc.php3 | 2 + lang/norwegian.inc.php3 | 2 + lang/polish.inc.php3 | 2 + lang/portuguese.inc.php3 | 2 + lang/russian-koi8.inc.php3 | 2 + lang/russian-win1251.inc.php3 | 2 + lang/spanish.inc.php3 | 2 + lang/swedish.inc.php3 | 2 + lang/thai.inc.php3 | 2 + lib.inc.php3 | 310 +++++++++++++++++++---------- tbl_dump.php3 | 2 +- tbl_properties.php3 | 8 + 27 files changed, 269 insertions(+), 115 deletions(-) diff --git a/ChangeLog b/ChangeLog index 74515a575..082631103 100755 --- a/ChangeLog +++ b/ChangeLog @@ -6,8 +6,9 @@ $Id$ $Source$ 2001-07-13 Loïc Chapeaux - * left.php3: no DHTML if there is only one table to display - (feature #440420) + * lib.inc.php3, tbl_dump.php3, tbl_properties.php3, translations: added a + limitation feature for data dumps thanks to + Girish Nair and Vinay . * lib.inc.php3, lines 785-847: rewritten the 'show_message' function in order it generates a valid xhtml1.0 code and the programatically added 'LIMIT' clause is displayed only if it has been trully used. @@ -19,6 +20,8 @@ $Source$ - lines 83-89: fixed a bug if the sql query contains a 'limit' clause typed by the user. * db_readdump.php3.php3, line 64: removed a faulty fix for bug #439565. + * left.php3: no DHTML if there is only one table to display + (feature #440420) 2001-07-12 Marc Delisle * Documentation.html: added a FAQ entry about upload errors diff --git a/lang/brazilian_portuguese.inc.php3 b/lang/brazilian_portuguese.inc.php3 index ae009796a..4a35c8613 100644 --- a/lang/brazilian_portuguese.inc.php3 +++ b/lang/brazilian_portuguese.inc.php3 @@ -274,5 +274,7 @@ $strNotValidNumber = " is not a valid row number!"; //to translate // export Zip (July 07, 2001, 19:48am) $strGzip = "\"gzipped\""; //to translate +$strOffSet = "Offset"; +$strNbRecords = "No. Of records"; $strRowSize=" Row size "; //to translate ?> diff --git a/lang/bulgarian-win1251.inc.php3 b/lang/bulgarian-win1251.inc.php3 index 7edd42198..59bcc598b 100644 --- a/lang/bulgarian-win1251.inc.php3 +++ b/lang/bulgarian-win1251.inc.php3 @@ -274,5 +274,7 @@ $strNotValidNumber = " is not a valid row number!"; //to translate // export Zip (July 07, 2001, 19:48am) $strGzip = "\"gzipped\""; //to translate +$strOffSet = "Offset"; +$strNbRecords = "No. Of records"; $strRowSize=" Row size "; //to translate ?> diff --git a/lang/catala.inc.php3 b/lang/catala.inc.php3 index 705dc1829..2c3f305df 100644 --- a/lang/catala.inc.php3 +++ b/lang/catala.inc.php3 @@ -274,5 +274,7 @@ $strNotValidNumber = " is not a valid row number!"; //to translate // export Zip (July 07, 2001, 19:48am) $strGzip = "\"gzipped\""; //to translate +$strOffSet = "Offset"; +$strNbRecords = "No. Of records"; $strRowSize=" Row size "; //to translate ?> diff --git a/lang/chinese_big5.inc.php3 b/lang/chinese_big5.inc.php3 index 2a97396c3..0d37469ef 100644 --- a/lang/chinese_big5.inc.php3 +++ b/lang/chinese_big5.inc.php3 @@ -274,5 +274,7 @@ $strNotValidNumber = " is not a valid row number!"; //to translate // export Zip (July 07, 2001, 19:48am) $strGzip = "\"gzipped\""; //to translate +$strOffSet = "Offset"; +$strNbRecords = "No. Of records"; $strRowSize=" Row size "; //to translate ?> diff --git a/lang/chinese_gb.inc.php3 b/lang/chinese_gb.inc.php3 index 8cee8ade4..da3f81606 100644 --- a/lang/chinese_gb.inc.php3 +++ b/lang/chinese_gb.inc.php3 @@ -274,5 +274,7 @@ $strNotValidNumber = " is not a valid row number!"; //to translate // export Zip (July 07, 2001, 19:48am) $strGzip = "\"gzipped\""; //to translate +$strOffSet = "Offset"; +$strNbRecords = "No. Of records"; $strRowSize=" Row size "; //to translate ?> diff --git a/lang/czech-iso.inc.php3 b/lang/czech-iso.inc.php3 index 08fd5afe7..6c246d1c7 100644 --- a/lang/czech-iso.inc.php3 +++ b/lang/czech-iso.inc.php3 @@ -271,5 +271,7 @@ $strYes = "Ano"; // export Zip (July 07, 2001, 19:48am) $strGzip = "\"gzipped\""; //to translate +$strOffSet = "Offset"; +$strNbRecords = "No. Of records"; $strRowSize=" Row size "; //to translate ?> diff --git a/lang/czech-win1250.inc.php3 b/lang/czech-win1250.inc.php3 index 7ff9b1ced..d8020096f 100644 --- a/lang/czech-win1250.inc.php3 +++ b/lang/czech-win1250.inc.php3 @@ -271,5 +271,7 @@ $strYes = "Ano"; // export Zip (July 07, 2001, 19:48am) $strGzip = "\"gzipped\""; //to translate +$strOffSet = "Offset"; +$strNbRecords = "No. Of records"; $strRowSize=" Row size "; //to translate ?> diff --git a/lang/danish.inc.php3 b/lang/danish.inc.php3 index 1fb1ed010..329f2a85c 100644 --- a/lang/danish.inc.php3 +++ b/lang/danish.inc.php3 @@ -274,5 +274,7 @@ $strNotValidNumber = " is not a valid row number!"; //to translate // export Zip (July 07, 2001, 19:48am) $strGzip = "\"gzipped\""; //to translate +$strOffSet = "Offset"; +$strNbRecords = "No. Of records"; $strRowSize=" Row size "; //to translate ?> diff --git a/lang/dutch.inc.php3 b/lang/dutch.inc.php3 index 86f64deaa..5201f01e8 100644 --- a/lang/dutch.inc.php3 +++ b/lang/dutch.inc.php3 @@ -274,5 +274,7 @@ $strNotValidNumber = " is not a valid row number!"; //to translate // export Zip (July 07, 2001, 19:48am) $strGzip = "\"gzipped\""; //to translate +$strOffSet = "Offset"; +$strNbRecords = "No. Of records"; $strRowSize=" Row size "; //to translate ?> diff --git a/lang/english.inc.php3 b/lang/english.inc.php3 index bbc78e37b..a65d7bab3 100644 --- a/lang/english.inc.php3 +++ b/lang/english.inc.php3 @@ -38,6 +38,8 @@ $strAtEndOfTable = "At End of Table"; $strAttr = "Attributes"; $strBack = "Back"; +$strBinary = "Binary"; +$strBinaryDoNotEdit = "Binary - do not edit"; $strBookmarkLabel = "Label"; $strBookmarkQuery = "Bookmarked SQL-query"; $strBookmarkThis = "Bookmark this SQL-query"; @@ -93,6 +95,7 @@ $strEmptyResultSet = "MySQL returned an empty result set (i.e. zero rows)."; $strEnableMagicQuotes = "Warning: You haven't enabled magic_quotes_gpc in your PHP configuration. PhpMyAdmin needs this to work properly. Please have a look at the configuration section of the PHP manual for information on how to enable it."; $strEnclosedBy = "enclosed by"; $strEnd = "End"; +$strEnglishPrivileges = " Note: MySQL privilege names are expressed in English "; $strError = "Error"; $strEscapedBy = "escaped by"; $strExtra = "Extra"; @@ -149,6 +152,7 @@ $strMySQLShowStatus = "Show MySQL runtime information"; $strMySQLShowVars = "Show MySQL system variables"; $strName = "Name"; +$strNbRecords = "No. Of records"; $strNext = "Next"; $strNo = "No"; $strNoPassword = "No Password"; @@ -161,6 +165,7 @@ $strNoUsersFound = "No user(s) found."; $strNull = "Null"; $strNumberIndexes = " Number of advanced indexes "; +$strOffSet = "Offset"; $strOftenQuotation = "Often quotation marks. OPTIONALLY means that only char and varchar fields are enclosed by the \"enclosed by\"-character."; $strOptimizeTable = "Optimize table"; $strOptionalControls = "Optional. Controls how to write or read special characters."; @@ -204,6 +209,7 @@ $strRevokePriv = "Revoke Privileges"; $strRowLength = "Row length"; $strRows = "Rows"; $strRowsFrom = "rows starting from"; +$strRowSize = " Row size "; $strRowsStatistic = "Row Statistic"; $strRunning = "running on "; $strRunQuery = ""; //to translate, but its not in use ... @@ -267,11 +273,4 @@ $strWelcome = "Welcome to "; $strWrongUser = "Wrong username/password. Access denied."; $strYes = "Yes"; - -// automatic generated by langxlorer.php (June 27, 2001, 6:53 pm) -// V0.11 - experimental (Steve Alberty - alberty@neptunlabs.de) -$strBinary="Binary"; -$strBinaryDoNotEdit="Binary - do not edit"; -$strEnglishPrivileges=" Note: MySQL privilege names are expressed in English "; -$strRowSize=" Row size "; //to translate ?> diff --git a/lang/french.inc.php3 b/lang/french.inc.php3 index 9a18ca4b8..0b30d2c5a 100644 --- a/lang/french.inc.php3 +++ b/lang/french.inc.php3 @@ -151,6 +151,7 @@ $strMySQLShowStatus = "Afficher l' $strMySQLShowVars = "Afficher les variables du serveur MySQL"; $strName = "Nom"; +$strNbRecords = "Nb. d'enregistrements"; $strNext = "Suivant"; $strNo = "Non"; $strNoPassword = "aucun mot de passe"; @@ -163,6 +164,7 @@ $strNoUsersFound = "Il n'y a aucun utilisateur"; $strNull = "Null"; $strNumberIndexes = " Nombre d'index spéciaux "; +$strOffSet = "Début"; $strOftenQuotation = "Souvent des guillemets. OPTIONNEL signifie que seulement les champs de type char et varchar sont entourés par ce caractère."; $strOptimizeTable = "Optimiser la table"; $strOptionalControls = "Optionnel. Indique le caractère qui permet d'enlever l'effet des caractères spéciaux."; diff --git a/lang/german.inc.php3 b/lang/german.inc.php3 index b779d6fe9..f95ce2c24 100644 --- a/lang/german.inc.php3 +++ b/lang/german.inc.php3 @@ -274,5 +274,7 @@ $strNotValidNumber = " ist keine g // export Zip (July 07, 2001, 19:48am) $strGzip = "\"GZip komprimiert\""; +$strOffSet = "Offset"; +$strNbRecords = "No. Of records"; $strRowSize=" Zeilengröße "; ?> diff --git a/lang/italian.inc.php3 b/lang/italian.inc.php3 index 86c09505b..2601575bd 100644 --- a/lang/italian.inc.php3 +++ b/lang/italian.inc.php3 @@ -274,5 +274,7 @@ $strNotValidNumber = " is not a valid row number!"; //to translate // export Zip (July 07, 2001, 19:48am) $strGzip = "\"gzipped\""; //to translate +$strOffSet = "Offset"; +$strNbRecords = "No. Of records"; $strRowSize=" Row size "; //to translate ?> diff --git a/lang/japanese.inc.php3 b/lang/japanese.inc.php3 index 268d59570..99b1a930b 100644 --- a/lang/japanese.inc.php3 +++ b/lang/japanese.inc.php3 @@ -274,5 +274,7 @@ $strNotValidNumber = " is not a valid row number!"; //to translate // export Zip (July 07, 2001, 19:48am) $strGzip = "\"gzipped\""; //to translate +$strOffSet = "Offset"; +$strNbRecords = "No. Of records"; $strRowSize=" Row size "; //to translate ?> diff --git a/lang/korean.inc.php3 b/lang/korean.inc.php3 index 68dfa20da..32a182480 100644 --- a/lang/korean.inc.php3 +++ b/lang/korean.inc.php3 @@ -274,5 +274,7 @@ $strNotValidNumber = " is not a valid row number!"; //to translate // export Zip (July 07, 2001, 19:48am) $strGzip = "\"gzipped\""; //to translate +$strOffSet = "Offset"; +$strNbRecords = "No. Of records"; $strRowSize=" Row size "; //to translate ?> diff --git a/lang/norwegian.inc.php3 b/lang/norwegian.inc.php3 index 623d99b08..13d502993 100644 --- a/lang/norwegian.inc.php3 +++ b/lang/norwegian.inc.php3 @@ -274,5 +274,7 @@ $strNotValidNumber = " is not a valid row number!"; //to translate // export Zip (July 07, 2001, 19:48am) $strGzip = "\"gzipped\""; //to translate +$strOffSet = "Offset"; +$strNbRecords = "No. Of records"; $strRowSize=" Row size "; //to translate ?> diff --git a/lang/polish.inc.php3 b/lang/polish.inc.php3 index 1df52ee4e..8b59ed977 100644 --- a/lang/polish.inc.php3 +++ b/lang/polish.inc.php3 @@ -274,5 +274,7 @@ $strNotValidNumber = " is not a valid row number!"; //to translate // export Zip (July 07, 2001, 19:48am) $strGzip = "\"gzipped\""; //to translate +$strOffSet = "Offset"; +$strNbRecords = "No. Of records"; $strRowSize=" Row size "; //to translate ?> diff --git a/lang/portuguese.inc.php3 b/lang/portuguese.inc.php3 index 5c90880a5..c3fe12ad8 100644 --- a/lang/portuguese.inc.php3 +++ b/lang/portuguese.inc.php3 @@ -274,5 +274,7 @@ $strNotValidNumber = " is not a valid row number!"; //to translate // export Zip (July 07, 2001, 19:48am) $strGzip = "\"gzipped\""; //to translate +$strOffSet = "Offset"; +$strNbRecords = "No. Of records"; $strRowSize=" Row size "; //to translate ?> diff --git a/lang/russian-koi8.inc.php3 b/lang/russian-koi8.inc.php3 index 4f5755fe7..557a9ca36 100644 --- a/lang/russian-koi8.inc.php3 +++ b/lang/russian-koi8.inc.php3 @@ -274,5 +274,7 @@ $strNotValidNumber = " is not a valid row number!"; //to translate // export Zip (July 07, 2001, 19:48am) $strGzip = "\"gzipped\""; //to translate +$strOffSet = "Offset"; +$strNbRecords = "No. Of records"; $strRowSize=" Row size "; //to translate ?> diff --git a/lang/russian-win1251.inc.php3 b/lang/russian-win1251.inc.php3 index 292da0e48..e7935337c 100644 --- a/lang/russian-win1251.inc.php3 +++ b/lang/russian-win1251.inc.php3 @@ -274,5 +274,7 @@ $strNotValidNumber = " is not a valid row number!"; //to translate // export Zip (July 07, 2001, 19:48am) $strGzip = "\"gzipped\""; //to translate +$strOffSet = "Offset"; +$strNbRecords = "No. Of records"; $strRowSize=" Row size "; //to translate ?> diff --git a/lang/spanish.inc.php3 b/lang/spanish.inc.php3 index 90d934eb8..1c6a72471 100644 --- a/lang/spanish.inc.php3 +++ b/lang/spanish.inc.php3 @@ -271,5 +271,7 @@ $strYes = "Si"; // export Zip (July 07, 2001, 19:48am) $strGzip = "\"gzipped\""; //to translate +$strOffSet = "Offset"; +$strNbRecords = "No. Of records"; $strRowSize = " Row size "; //to translate ?> \ No newline at end of file diff --git a/lang/swedish.inc.php3 b/lang/swedish.inc.php3 index f846818f1..2404ccc1f 100644 --- a/lang/swedish.inc.php3 +++ b/lang/swedish.inc.php3 @@ -274,5 +274,7 @@ $strNotValidNumber = " is not a valid row number!"; //to translate // export Zip (July 07, 2001, 19:48am) $strGzip = "\"gzipped\""; //to translate +$strOffSet = "Offset"; +$strNbRecords = "No. Of records"; $strRowSize=" Row size "; //to translate ?> diff --git a/lang/thai.inc.php3 b/lang/thai.inc.php3 index 9a7760d45..1ed41fe18 100644 --- a/lang/thai.inc.php3 +++ b/lang/thai.inc.php3 @@ -274,5 +274,7 @@ $strNotValidNumber = " is not a valid row number!"; //to translate // export Zip (July 07, 2001, 19:48am) $strGzip = "\"gzipped\""; //to translate +$strOffSet = "Offset"; +$strNbRecords = "No. Of records"; $strRowSize=" Row size "; //to translate ?> diff --git a/lib.inc.php3 b/lib.inc.php3 index f4a2c6021..7e711ea4d 100755 --- a/lib.inc.php3 +++ b/lib.inc.php3 @@ -600,123 +600,223 @@ function get_table_def($db, $table, $crlf) } } -// Get the content of $table as a series of INSERT statements. -// After every row, a custom callback function $handler gets called. -// $handler must accept one parameter ($sql_insert); - -function get_table_content ($db, $table, $handler){ - if (PMA_INT_VERSION>=40005) get_table_content_fast($db, $table, $handler); - else get_table_content_old($db, $table, $handler); -} - - -// only php >= 4.0.5 - staybyte - 27. June 2001 -function get_table_content_fast($db, $table, $handler){ - $result = mysql_query("SELECT * FROM ".db_name($db)."." . - tbl_name($table)) or mysql_die(); - if ($result!=false){ - for($j=0; $j 0) { + $limit_from--; + } else { + $limit_from = 0; + } + if ($limit_to > 0 && $limit_from >= 0) { + $add_query = " LIMIT $limit_from, $limit_to"; + } else { + $add_query = ''; + } - for($j=0; $j= 40005) { + get_table_content_fast($db, $table, $add_query, $handler); + } else { + get_table_content_old($db, $table, $add_query, $handler); + } +} // end of the 'get_table_content()' function - $table_list = substr($table_list,0,-2); - $table_list .= ")"; - if(isset($GLOBALS["showcolumns"])) - $schema_insert = "INSERT INTO $table $table_list VALUES ("; - else +/** + * php >= 4.0.5 only : get the content of $table as a series of INSERT + * statements. + * After every row, a custom callback function $handler gets called. + * + * @param string the current database name + * @param string the current table name + * @param string the 'limit' clause to use with the sql query + * @param string the name of the handler (function) to use at the end of + * every row. This handler must accept one parameter + * ($sql_insert) + * + * @return boolean always true + * + * @author staybyte + * + * Last revision 13 July 2001: Patch for limiting dump size from + * vinay@sanisoft.com & girish@sanisoft.com + */ +function get_table_content_fast($db, $table, $add_query = '', $handler) +{ + $result = mysql_query('SELECT * FROM ' . db_name($db) . '.' . tbl_name($table). $add_query) or mysql_die(); + if ($result != false) { + + // Checks whether the field is an integer or not + for ($j = 0; $j < mysql_num_fields($result); $j++) { + $field_set[$j] = mysql_field_name($result, $j); + $type = mysql_field_type($result, $j); + if ($type == 'tinyint' || $type == 'smallint' || $type == 'mediumint' || $type == 'int' || + $type == 'bigint' ||$type == 'timestamp') { + $field_num[$j] = true; + } else { + $field_num[$j] = false; + } + } // end for + + // Get the scheme + if (isset($GLOBALS['showcolumns'])) { + $fields = implode(', ', $field_set); + $schema_insert = "INSERT INTO $table ($fields) VALUES ("; + } else { $schema_insert = "INSERT INTO $table VALUES ("; - - for ($j=0; $j
+ + +
+   +   +   + +