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:
parent
9fd9fd7bbd
commit
e5f495a745
|
@ -721,14 +721,17 @@ class PDOSQLiteDriver {
|
||||||
private function rewrite_between() {
|
private function rewrite_between() {
|
||||||
if (!$this->rewrite_between) return;
|
if (!$this->rewrite_between) return;
|
||||||
$pattern = '/\\s*(CAST\([^\)]+?\)|[^\\s\(]*)?\\s*BETWEEN\\s*([^\\s]*)?\\s*AND\\s*([^\\s\)]*)?\\s*/ims';
|
$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]);
|
$column_name = trim($match[1]);
|
||||||
$min_value = trim($match[2]);
|
$min_value = trim($match[2]);
|
||||||
$max_value = trim($match[3]);
|
$max_value = trim($match[3]);
|
||||||
$max_value = rtrim($max_value);
|
$max_value = rtrim($max_value);
|
||||||
$replacement = " $column_name >= $min_value AND $column_name <= $max_value";
|
$replacement = " $column_name >= $min_value AND $column_name <= $max_value";
|
||||||
$this->_query = str_ireplace($match[0], $replacement, $this->_query);
|
$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.
|
* Method to avoid DELETE with JOIN statement.
|
||||||
|
|
Loading…
Reference in New Issue