mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
Added NOT IN in format mysql filter
Former-commit-id: f3a8cdd6923834443ed7223d1e6ad7776b861184
This commit is contained in:
parent
54f0bc1a03
commit
0b72571c7c
@ -616,6 +616,7 @@ function mysql_db_format_array_where_clause_sql ($values, $join = 'AND', $prefix
|
|||||||
$i = 1;
|
$i = 1;
|
||||||
$max = count ($values);
|
$max = count ($values);
|
||||||
foreach ($values as $field => $value) {
|
foreach ($values as $field => $value) {
|
||||||
|
$negative = false;
|
||||||
if (is_numeric ($field)) {
|
if (is_numeric ($field)) {
|
||||||
/* User provide the exact operation to do */
|
/* User provide the exact operation to do */
|
||||||
$query .= $value;
|
$query .= $value;
|
||||||
@ -626,7 +627,10 @@ function mysql_db_format_array_where_clause_sql ($values, $join = 'AND', $prefix
|
|||||||
$i++;
|
$i++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if ($field[0] == "!") {
|
||||||
|
$negative = true;
|
||||||
|
$field = substr($field, 1);
|
||||||
|
}
|
||||||
if ($field[0] != "`") {
|
if ($field[0] != "`") {
|
||||||
//If the field is as <table>.<field>, don't scape.
|
//If the field is as <table>.<field>, don't scape.
|
||||||
if (strstr($field, '.') === false)
|
if (strstr($field, '.') === false)
|
||||||
@ -643,7 +647,8 @@ function mysql_db_format_array_where_clause_sql ($values, $join = 'AND', $prefix
|
|||||||
$query .= sprintf ("%s = %f", $field, $value);
|
$query .= sprintf ("%s = %f", $field, $value);
|
||||||
}
|
}
|
||||||
elseif (is_array ($value)) {
|
elseif (is_array ($value)) {
|
||||||
$query .= sprintf ('%s IN ("%s")', $field, implode ('", "', $value));
|
$not = $negative ? ' NOT ' : '';
|
||||||
|
$query .= sprintf ('%s %sIN ("%s")', $field, $not, implode ('", "', $value));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($value === "") {
|
if ($value === "") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user