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() {