From b0e46845abcdede5665fa35af39ac31c2e56c2fe Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Fri, 4 Oct 2019 12:56:37 +0900 Subject: [PATCH] Update database.php --- system/database.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/system/database.php b/system/database.php index 50f0aa4..14b469e 100644 --- a/system/database.php +++ b/system/database.php @@ -667,7 +667,7 @@ if(!check_function_exists("get_timediff_on_query")) { $row = exec_db_fetch($sql, $bind); $dt = get_value_in_array("dt", $row, $dt); - return $dt; + return $dt;tio } } @@ -691,6 +691,23 @@ if(!check_function_exists("json_decode_to_assoc")) { } } +// temporary table +if(!check_function_exists("exec_db_temp_start")) { + function exec_db_temp_start($sql, $bind, $options=array()) { + $_tablename = make_random_id(); + $_sql = sprintf("create temporary table if not exists %s as (%s)", $_tablename, get_db_binded_sql($sql, $bind)); + return (exec_db_query($_sql) ? $_tablename : false); + } +} + +// temporary table +if(!check_function_exists("exec_db_temp_end")) { + function exec_db_temp_end($tablename) { + $_sql = sprintf("drop temporary table %s", $tablename); + return exec_db_query($_sql); + } +} + // close db connection if(!check_function_exists("close_db_connect")) { function close_db_connect() {