From ca32f7c10136db1922ce332e406b69063cf0d1f6 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Fri, 3 May 2019 20:19:43 +0900 Subject: [PATCH] Update database.php --- system/database.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/system/database.php b/system/database.php index 77d2b5d..6845214 100644 --- a/system/database.php +++ b/system/database.php @@ -394,14 +394,18 @@ if(!check_function_exists("get_bind_to_sql_select")) { $addfields = $options['setfields']; foreach($addfields as $k=>$v) { - $exps = array(); + // concat and delimiter if(!array_keys_empty(array("concat", "delimiter"), $v)) { - foreach($v['concat'] as $exp) { - $exps[] = $exp; - } - // 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])); + } } } }