recovered. changes from 0b72571c7c [formerly f3a8cdd6923834443ed7223d1e6ad7776b861184]

Former-commit-id: 591e002043d2bae2382c8a91c437057fd2b809c7
This commit is contained in:
fbsanchez 2019-02-18 15:36:51 +01:00
parent 27602d8e49
commit 37f6da9aa8
1 changed files with 8 additions and 1 deletions

View File

@ -706,6 +706,7 @@ function mysql_db_format_array_where_clause_sql($values, $join='AND', $prefix=fa
$i = 1;
$max = count($values);
foreach ($values as $field => $value) {
$negative = false;
if (is_numeric($field)) {
// User provide the exact operation to do
$query .= $value;
@ -718,6 +719,11 @@ function mysql_db_format_array_where_clause_sql($values, $join='AND', $prefix=fa
continue;
}
if ($field[0] == '!') {
$negative = true;
$field = substr($field, 1);
}
if ($field[0] != '`') {
// If the field is as <table>.<field>, don't scape.
if (strstr($field, '.') === false) {
@ -732,7 +738,8 @@ function mysql_db_format_array_where_clause_sql($values, $join='AND', $prefix=fa
} else if (is_float($value) || is_double($value)) {
$query .= sprintf('%s = %f', $field, $value);
} else if (is_array($value)) {
$query .= sprintf('%s IN ("%s")', $field, implode('", "', $value));
$not = $negative ? ' NOT ' : '';
$query .= sprintf('%s %sIN ("%s")', $field, $not, implode('", "', $value));
} else {
if ($value === '') {
// Search empty string