Update database.php

This commit is contained in:
Namhyeon Go 2020-02-05 11:29:03 +09:00 committed by GitHub
parent 8238963319
commit 61d88d74e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -450,9 +450,18 @@ if(!check_function_exists("get_bind_to_sql_where")) {
"gte" => ">=",
"not" => "<>"
);
$opfield = $opts[1][1];
$opcode = get_value_in_array($opts[1][0], $ssts, $opts[1][0]);
if(!empty($opcode)) {
$s3 .= sprintf(" %s (%s %s '%s')", $opts[0], $opts[1][1], $opcode, $opts[1][2]);
$opvalue = $opts[1][2];
// Fixed issue: mysql where clause not working if column value is null #91
if($opcode == "<>") {
if(is_null($opvalue)) {
$s3 .= sprintf(" %s (%s is not null)", $opts[0], $opfield);
} else {
$s3 .= sprintf(" %s (%s %s '%s' or %s is null)", $opts[0], $opfield, $opcode, $opvalue, $opfield);
}
} else {
$s3 .= sprintf(" %s (%s %s '%s')", $opts[0], $opfield, $opcode, $opvalue);
}
}
} elseif(check_array_length($opts, 2) == 0) {