Update database.php

This commit is contained in:
Namhyeon Go 2019-10-15 19:25:31 +09:00 committed by GitHub
parent d89d57eddd
commit cdeaba3a6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -672,6 +672,7 @@ if(!check_function_exists("get_timediff_on_query")) {
} }
// temporary table // temporary table
if(!check_function_exists("exec_db_temp_create")) {
function exec_db_temp_create($schemes=array(), $options=array()) { function exec_db_temp_create($schemes=array(), $options=array()) {
$_tablename = make_random_id(); $_tablename = make_random_id();
$_schemes = array(); $_schemes = array();
@ -687,8 +688,9 @@ function exec_db_temp_create($schemes=array(), $options=array()) {
} }
} }
} }
$sql = sprintf("create temporary table %s (%s)", $_tablename, implode(",", $_schemes)); $sql = sprintf("create temporary table if not exists %s (%s)", $_tablename, implode(",", $_schemes));
return return (exec_db_query($_sql) ? $_tablename : false); return (exec_db_query($_sql) ? $_tablename : false);
}
} }
if(!check_function_exists("exec_db_temp_start")) { if(!check_function_exists("exec_db_temp_start")) {