From 39f110f82cfe19711851d6adaf573a752213484c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 10 Mar 2004 11:01:50 +0000 Subject: [PATCH] Support for unbuffered queries - PMA_DBI_QUERY_UNBUFFERED and fix support of PMA_DBI_QUERY_STORE. --- libraries/database_interface.lib.php | 3 ++- libraries/dbi/mysql.dbi.lib.php | 8 +++++++- libraries/dbi/mysqli.dbi.lib.php | 4 +++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/libraries/database_interface.lib.php b/libraries/database_interface.lib.php index 332a988c7..b0a78e7e2 100644 --- a/libraries/database_interface.lib.php +++ b/libraries/database_interface.lib.php @@ -5,7 +5,8 @@ /** * Common Option Constants For DBI Functions */ -define('PMA_DBI_QUERY_STORE', 1); // Force STORE_RESULT method, ignored by classic MySQL. +define('PMA_DBI_QUERY_STORE', 1); // Force STORE_RESULT method, ignored by classic MySQL. +define('PMA_DBI_QUERY_UNBUFFERED', 2); // Do not read whole query /** * Including The DBI Plugin diff --git a/libraries/dbi/mysql.dbi.lib.php b/libraries/dbi/mysql.dbi.lib.php index f1b003bff..b44bb3bd3 100644 --- a/libraries/dbi/mysql.dbi.lib.php +++ b/libraries/dbi/mysql.dbi.lib.php @@ -119,7 +119,13 @@ function PMA_DBI_try_query($query, $link = NULL, $options = 0) { if (PMA_MYSQL_INT_VERSION < 40100) { $query = PMA_convert_charset($query); } - return mysql_query($query, $link); + if ($options == ($options | PMA_DBI_QUERY_STORE)) { + return mysql_query($query, $link); + } elseif ($options == ($options | PMA_DBI_QUERY_UNBUFFERED)) { + return mysql_unbuffered_query($query, $link); + } else { + return mysql_query($query, $link); + } } // The following function is meant for internal use only. diff --git a/libraries/dbi/mysqli.dbi.lib.php b/libraries/dbi/mysqli.dbi.lib.php index 050cfe0bf..61b902684 100644 --- a/libraries/dbi/mysqli.dbi.lib.php +++ b/libraries/dbi/mysqli.dbi.lib.php @@ -92,8 +92,10 @@ function PMA_DBI_select_db($dbname, $link = NULL) { } function PMA_DBI_try_query($query, $link = NULL, $options = 0) { - if ($options == $options | PMA_DBI_QUERY_STORE) { + if ($options == ($options | PMA_DBI_QUERY_STORE)) { $method = MYSQLI_STORE_RESULT; + } elseif ($options == ($options | PMA_DBI_QUERY_UNBUFFERED)) { + $method = MYSQLI_USE_RESULT; } else { $method = MYSQLI_USE_RESULT; }