Update database.php

This commit is contained in:
Namhyeon Go 2019-05-03 20:19:43 +09:00 committed by GitHub
parent 0ab27c35bc
commit ca32f7c101
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -394,14 +394,18 @@ if(!check_function_exists("get_bind_to_sql_select")) {
$addfields = $options['setfields']; $addfields = $options['setfields'];
foreach($addfields as $k=>$v) { foreach($addfields as $k=>$v) {
$exps = array(); // concat and delimiter
if(!array_keys_empty(array("concat", "delimiter"), $v)) { if(!array_keys_empty(array("concat", "delimiter"), $v)) {
foreach($v['concat'] as $exp) {
$exps[] = $exp;
}
// add to s1a // add to s1a
$s1a[$k] = sprintf("concat(%s)", implode(sprintf(", '%s', ", $v['delimiter']), $exps)); $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'], 2)) {
// add to s1a
$s1a[$k] = sprintf("%s(%s)", $v['call_func'][0], implode(", ", $v['call_func'][1]));
}
} }
} }
} }