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
This commit is contained in:
kjmtsh 2014-06-17 22:52:14 +00:00
parent 9fd9fd7bbd
commit e5f495a745
1 changed files with 4 additions and 1 deletions

View File

@ -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.