From 164c7157a618e858a6729fae4ad558636c27893f Mon Sep 17 00:00:00 2001 From: Sergey Tsalkov Date: Fri, 23 Sep 2011 15:57:36 -0700 Subject: [PATCH] queryRaw() will now be officially supported, returns mysqli_result instead of array of assoc arrays --- db.class.php | 1 + simpletest/BasicTest.php | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/db.class.php b/db.class.php index a03f6a3..080a603 100644 --- a/db.class.php +++ b/db.class.php @@ -357,6 +357,7 @@ class DB } public static function queryNull() { $args = func_get_args(); return DB::prependCall('DB::queryHelper', $args, 'null'); } + public static function queryRaw() { $args = func_get_args(); return DB::prependCall('DB::queryHelper', $args, 'buffered'); } public static function queryBuf() { $args = func_get_args(); return DB::prependCall('DB::queryHelper', $args, 'buffered'); } public static function queryUnbuf() { $args = func_get_args(); return DB::prependCall('DB::queryHelper', $args, 'unbuffered'); } diff --git a/simpletest/BasicTest.php b/simpletest/BasicTest.php index 201113f..da92559 100644 --- a/simpletest/BasicTest.php +++ b/simpletest/BasicTest.php @@ -97,6 +97,12 @@ class BasicTest extends SimpleTest { $this->assert($username === 'Bart'); $this->assert($password === 'hello'); $this->assert($age == 15); + + $mysqli_result = DB::queryRaw("SELECT * FROM accounts WHERE favorite_word IS NULL"); + $this->assert($mysqli_result instanceof MySQLi_Result); + $row = $mysqli_result->fetch_assoc(); + $this->assert($row['password'] === 'goodbye'); + $this->assert($mysqli_result->fetch_assoc() === null); } function test_4_query() {