From ce7cc612ac698558ee559ceba318159a46e0731a Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Thu, 9 Jan 2020 22:03:41 +0900 Subject: [PATCH] Update database.php --- system/database.php | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/system/database.php b/system/database.php index ae55154..b276e98 100644 --- a/system/database.php +++ b/system/database.php @@ -301,23 +301,25 @@ if(!check_function_exists("get_bind_to_sql_insert")) { $num_duplicates = 0; // do process - $_bind_K = array(); - $_bind_V = array(); - foreach($bind as $k=>$v) { - if(in_array($k, $setduplicate)) { - $_bind_K[$k] = $v; - } else { - $_bind_V[$k] = $v; + if(count($setduplicate) > 0) { + $_bind_K = array(); + $_bind_V = array(); + foreach($bind as $k=>$v) { + if(in_array($k, $setduplicate)) { + $_bind_K[$k] = $v; + } else { + $_bind_V[$k] = $v; + } + } + $_sql = get_bind_to_sql_select($tablename, $_bind_K, array( + "getcount" => true, + "setwheres" => $setnotwhere + )); + write_common_log($_sql, "BBBBBB"); + $_rows = exec_db_fetch_all($_sql, $_bind_K); + foreach($_rows as $_row) { + $num_duplicates += intval($_row['value']); } - } - $_sql = get_bind_to_sql_select($tablename, $_bind_K, array( - "getcount" => true, - "setwheres" => $setnotwhere - )); - write_common_log($_sql, "AAAAAAAA"); - $_rows = exec_db_fetch_all($_sql, $_bind_K); - foreach($_rows as $_row) { - $num_duplicates += intval($_row['value']); } // make statements