From ee338359a8db9987fa8d096dd9949b4cc03097ad Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 9 Jul 2008 11:29:20 -0400 Subject: [PATCH] Use a regex to match queries that need Result objects, because it's more than just SELECT * Db.php: (BSDb::query): SELECT, DESCRIBE, and EXPLAIN queries all need a Result object --- CHANGES | 4 ++++ Db.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index c16ddd3..81fa2e2 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +3.1.2 +=================== +- Fixed: BSDb::query() would not generate a Result object for explain, show, and describe queries + 3.1.1 =================== - Fixed: BSMail::send() would fail if sending a HTML/multipart email because it would call BSFunctions::Rand() diff --git a/Db.php b/Db.php index 5923e0e..27d1fb2 100644 --- a/Db.php +++ b/Db.php @@ -164,7 +164,7 @@ abstract class BSDb } } - if (strtoupper(substr(trim($string), 0, 6)) == 'SELECT') + if (preg_match('/^\s*(select|describe|show|explain)/i', $string)) { $class = get_class($this) . 'Result'; return new $class($this->result); -- 2.43.5