From db0feccfd44521dee86a3562292f732cb95ed370 Mon Sep 17 00:00:00 2001 From: Sergey Tsalkov Date: Wed, 9 Feb 2011 13:32:49 -0500 Subject: [PATCH] query() can default to buffered, unbuffered, or queryAllRows --- db.class.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/db.class.php b/db.class.php index 59d6cd9..6a90059 100644 --- a/db.class.php +++ b/db.class.php @@ -16,6 +16,7 @@ class DB public static $password = ''; public static $host = 'localhost'; public static $encoding = 'latin1'; + public static $queryMode = 'buffered'; //buffered, unbuffered, queryAllRows public static function get($dbName = '') { static $mysql = null; @@ -247,7 +248,14 @@ class DB } public static function quickPrepare() { return call_user_func_array('DB::query', func_get_args()); } - public static function query() { return DB::prependCall('DB::queryHelper', func_get_args(), 'buffered'); } + + public static function query() { + if (DB::$queryMode == 'buffered' || DB::$queryMode == 'unbuffered') { + return DB::prependCall('DB::queryHelper', func_get_args(), DB::$queryMode); + } else { + return call_user_func_array('DB::queryAllRows', func_get_args()); + } + } public static function queryNull() { return DB::prependCall('DB::queryHelper', func_get_args(), 'null'); } public static function queryBuf() { return DB::prependCall('DB::queryHelper', func_get_args(), 'buffered'); }