Update database.php

This commit is contained in:
Namhyeon Go 2019-06-18 16:17:30 +09:00 committed by GitHub
parent 923eb1e3cc
commit 1925a391b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -371,13 +371,20 @@ if(!check_function_exists("get_bind_to_sql_select")) {
$s1a[$k] = sprintf("concat(%s)", implode(sprintf(", '%s', ", $v['delimiter']), $v['concat']));
}
// use function
if(!array_key_empty("call_func", $v)) {
if(check_array_length($v['call_func'], 1) > 0) {
// use mysql function
if(!array_key_empty("sql_function", $v)) {
if(check_array_length($v['sql_function'], 1) > 0) {
// add to s1a
$s1a[$k] = sprintf("%s(%s)", $v['call_func'][0], implode(", ", array_slice($v['call_func'], 1)));
$s1a[$k] = sprintf("%s(%s)", $v['sql_function'][0], implode(", ", array_slice($v['sql_function'], 1)));
}
}
// use simple distance
if(!array_key_empty("simple_distance", $v)) {
$a = $v['simple_distance'][0];
$b = $v['simple_distance'][1];
$s1a[$k] = sprintf("abs(1.0 - (abs(%s - %s) / %s))", $b, $a, $a);
}
}
}