From e5f495a7453f2350446dacf7b32875fb320e4ccd Mon Sep 17 00:00:00 2001 From: kjmtsh Date: Tue, 17 Jun 2014 22:52:14 +0000 Subject: [PATCH] Yet another fix for manipulating multiple meta query git-svn-id: https://plugins.svn.wordpress.org/sqlite-integration/trunk@934021 b8457f37-d9ea-0310-8a92-e5e31aec5664 --- query.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/query.class.php b/query.class.php index c2d9567..44c5165 100644 --- a/query.class.php +++ b/query.class.php @@ -721,14 +721,17 @@ class PDOSQLiteDriver { private function rewrite_between() { if (!$this->rewrite_between) return; $pattern = '/\\s*(CAST\([^\)]+?\)|[^\\s\(]*)?\\s*BETWEEN\\s*([^\\s]*)?\\s*AND\\s*([^\\s\)]*)?\\s*/ims'; - while (preg_match($pattern, $this->_query, $match)) { + if (preg_match($pattern, $this->_query, $match)) { $column_name = trim($match[1]); $min_value = trim($match[2]); $max_value = trim($match[3]); $max_value = rtrim($max_value); $replacement = " $column_name >= $min_value AND $column_name <= $max_value"; $this->_query = str_ireplace($match[0], $replacement, $this->_query); + $this->rewrite_between = false; } + $this->parse_query(); + $this->rewrite_between(); } /** * Method to avoid DELETE with JOIN statement.