Update database.php

This commit is contained in:
Namhyeon Go 2020-01-28 13:49:10 +09:00 committed by GitHub
parent 03f28612a8
commit 339d10e94c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1002,19 +1002,12 @@ if(!check_function_exists("exec_db_temp_create")) {
$flag = false; $flag = false;
// set tablename // set tablename
$tablename = "temp_" . make_random_id(); $tablename = make_random_id();
// set track information // set track information
$_tablename = exec_db_table_create(array( $temptables = get_array(get_shared_var("temptables"));
"table_name" => array("varchar", 255), $temptables[] = $tablename;
"datetime" => array("datetime") set_shared_var("temptables", $temptables);
), "_temporary");
$_bind = array(
"table_name" => $tablename,
"datetime" => get_current_datetime()
);
$_sql = get_bind_to_sql_insert($_tablename, $_bind);
exec_db_query($_sql, $_bind);
// set variables // set variables
$_engine = get_value_in_array("engine", $options, false); $_engine = get_value_in_array("engine", $options, false);
@ -1050,14 +1043,24 @@ if(!check_function_exists("exec_db_temp_start")) {
} }
} }
// temporary table // clear specific temporary table
if(!check_function_exists("exec_db_temp_end")) { if(!check_function_exists("exec_db_temp_end")) {
function exec_db_temp_end($tablename, $options=array()) { function exec_db_temp_end($tablename) {
$sql = sprintf("drop temporary table `%s`", $tablename); $sql = sprintf("drop temporary table `%s`", $tablename);
return exec_db_query($sql); return exec_db_query($sql);
} }
} }
// clear temporery tables
if(!check_function_exists("exec_db_temp_clear")) {
function exec_db_temp_clear() {
$temptables = get_shared_var("temptables");
foreach($temptables as $tablename) {
exec_db_temp_end($tablename);
}
}
}
// close db connection // close db connection
if(!check_function_exists("close_db_connect")) { if(!check_function_exists("close_db_connect")) {
function close_db_connect() { function close_db_connect() {