Patch 890075 - Unbuffered query while exporting
This commit is contained in:
@@ -7,6 +7,10 @@ $Source$
|
|||||||
|
|
||||||
2004-03-10 Michal Cihar <michal@cihar.com>
|
2004-03-10 Michal Cihar <michal@cihar.com>
|
||||||
* export.php: Correctly report error when export fails.
|
* export.php: Correctly report error when export fails.
|
||||||
|
* libraries/database_interface.lib.php, libraries/dbi/mysql.dbi.lib.php,
|
||||||
|
libraries/dbi/mysqli.dbi.lib.php: Support for unbuffered queries -
|
||||||
|
PMA_DBI_QUERY_UNBUFFERED and fix support of PMA_DBI_QUERY_STORE.
|
||||||
|
* libraries/export/*.php: Use unbuffered queries (patch #890075).
|
||||||
|
|
||||||
2004-03-09 Marc Delisle <lem9@users.sourceforge.net>
|
2004-03-09 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
* libraries/common.lib.php, libraries/display*, lang/*:
|
* libraries/common.lib.php, libraries/display*, lang/*:
|
||||||
|
@@ -113,7 +113,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
|||||||
global $escaped;
|
global $escaped;
|
||||||
|
|
||||||
// Gets the data from the database
|
// Gets the data from the database
|
||||||
$result = PMA_DBI_query($sql_query);
|
$result = PMA_DBI_query($sql_query, NULL, PMA_DBI_QUERY_UNBUFFERED);
|
||||||
$fields_cnt = PMA_DBI_num_fields($result);
|
$fields_cnt = PMA_DBI_num_fields($result);
|
||||||
|
|
||||||
// If required, get fields name at the first line
|
// If required, get fields name at the first line
|
||||||
|
@@ -118,7 +118,7 @@ function PMA_exportDBCreate($db) {
|
|||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||||
$result = PMA_mysql_query($sql_query) or PMA_mysqlDie('', $sql_query, '', $error_url);
|
$result = PMA_mysql_query($sql_query, NULL, PMA_DBI_QUERY_UNBUFFERED);
|
||||||
|
|
||||||
$columns_cnt = PMA_DBI_num_fields($result);
|
$columns_cnt = PMA_DBI_num_fields($result);
|
||||||
for ($i = 0; $i < $columns_cnt; $i++) {
|
for ($i = 0; $i < $columns_cnt; $i++) {
|
||||||
|
@@ -402,19 +402,18 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
|||||||
|
|
||||||
$buffer = '';
|
$buffer = '';
|
||||||
|
|
||||||
$result = PMA_DBI_query($sql_query);
|
// get the real types of the table's fields (in an array)
|
||||||
|
// the key of the array is the backquoted field name
|
||||||
|
$field_types = PMA_fieldTypes($db,$table,$use_backquotes);
|
||||||
|
|
||||||
|
// analyze the query to get the true column names, not the aliases
|
||||||
|
// (this fixes an undefined index, also if Complete inserts
|
||||||
|
// are used, we did not get the true column name in case of aliases)
|
||||||
|
$analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($sql_query));
|
||||||
|
|
||||||
|
$result = PMA_DBI_query($sql_query, NULL, PMA_DBI_QUERY_UNBUFFERED);
|
||||||
if ($result != FALSE) {
|
if ($result != FALSE) {
|
||||||
$fields_cnt = PMA_DBI_num_fields($result);
|
$fields_cnt = PMA_DBI_num_fields($result);
|
||||||
$rows_cnt = PMA_DBI_num_rows($result);
|
|
||||||
|
|
||||||
// get the real types of the table's fields (in an array)
|
|
||||||
// the key of the array is the backquoted field name
|
|
||||||
$field_types = PMA_fieldTypes($db,$table,$use_backquotes);
|
|
||||||
|
|
||||||
// analyze the query to get the true column names, not the aliases
|
|
||||||
// (this fixes an undefined index, also if Complete inserts
|
|
||||||
// are used, we did not get the true column name in case of aliases)
|
|
||||||
$analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($sql_query));
|
|
||||||
|
|
||||||
// Checks whether the field is an integer or not
|
// Checks whether the field is an integer or not
|
||||||
for ($j = 0; $j < $fields_cnt; $j++) {
|
for ($j = 0; $j < $fields_cnt; $j++) {
|
||||||
@@ -474,6 +473,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
|||||||
$search = array("\x00", "\x0a", "\x0d", "\x1a"); //\x08\\x09, not required
|
$search = array("\x00", "\x0a", "\x0d", "\x1a"); //\x08\\x09, not required
|
||||||
$replace = array('\0', '\n', '\r', '\Z');
|
$replace = array('\0', '\n', '\r', '\Z');
|
||||||
$current_row = 0;
|
$current_row = 0;
|
||||||
|
$separator = isset($GLOBALS['extended_ins']) ? ',' : ';';
|
||||||
|
|
||||||
while ($row = PMA_DBI_fetch_row($result)) {
|
while ($row = PMA_DBI_fetch_row($result)) {
|
||||||
$current_row++;
|
$current_row++;
|
||||||
@@ -524,9 +524,10 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
|||||||
}
|
}
|
||||||
unset($values);
|
unset($values);
|
||||||
|
|
||||||
if (!PMA_exportOutputHandler($insert_line . ((isset($GLOBALS['extended_ins']) && ($current_row < $rows_cnt)) ? ',' : ';') . $crlf)) return FALSE;
|
if (!PMA_exportOutputHandler(($current_row == 1 ? '' : $separator . $crlf) . $insert_line)) return FALSE;
|
||||||
|
|
||||||
} // end while
|
} // end while
|
||||||
|
if (!PMA_exportOutputHandler(';' . $crlf)) return FALSE;
|
||||||
} // end if ($result != FALSE)
|
} // end if ($result != FALSE)
|
||||||
PMA_DBI_free_result($result);
|
PMA_DBI_free_result($result);
|
||||||
|
|
||||||
|
@@ -113,7 +113,7 @@ function PMA_exportDBCreate($db) {
|
|||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
function PMA_exportData($db, $table, $crlf, $error_url, $sql_query) {
|
||||||
$result = PMA_DBI_query($sql_query);
|
$result = PMA_DBI_query($sql_query, NULL, PMA_DBI_QUERY_UNBUFFERED);
|
||||||
|
|
||||||
$columns_cnt = PMA_DBI_num_fields($result);
|
$columns_cnt = PMA_DBI_num_fields($result);
|
||||||
for ($i = 0; $i < $columns_cnt; $i++) {
|
for ($i = 0; $i < $columns_cnt; $i++) {
|
||||||
|
Reference in New Issue
Block a user