Update database.php

This commit is contained in:
Namhyeon Go 2019-10-04 12:56:37 +09:00 committed by GitHub
parent a932e44eab
commit b0e46845ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -667,7 +667,7 @@ if(!check_function_exists("get_timediff_on_query")) {
$row = exec_db_fetch($sql, $bind); $row = exec_db_fetch($sql, $bind);
$dt = get_value_in_array("dt", $row, $dt); $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 // 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() {