Update database.php

This commit is contained in:
Namhyeon Go 2020-01-01 17:12:57 +09:00 committed by GitHub
parent 60227262ac
commit 66eebcf21c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,7 +2,7 @@
/** /**
* @file database.php * @file database.php
* @created_on 2018-04-13 * @created_on 2018-04-13
* @updated_on 2019-12-31 * @updated_on 2020-01-01
* @author Go Namhyeon <gnh1201@gmail.com> * @author Go Namhyeon <gnh1201@gmail.com>
* @brief Database module * @brief Database module
*/ */
@ -605,7 +605,7 @@ if(!check_function_exists("get_bind_to_sql_select")) {
foreach($_rows as $_row) { foreach($_rows as $_row) {
$separated_sqls[] = sprintf($sql, $s1, $_row['table_name'], $s3, $s4, $s5); $separated_sqls[] = sprintf($sql, $s1, $_row['table_name'], $s3, $s4, $s5);
} }
$sql = sprintf("(%s)", implode(") union (", $separated_sqls)); $sql = sprintf("%s", implode(" union ", $separated_sqls));
} }
return $sql; return $sql;
@ -850,7 +850,8 @@ if(!check_function_exists("exec_db_temp_create")) {
if(!check_function_exists("exec_db_temp_start")) { if(!check_function_exists("exec_db_temp_start")) {
function exec_db_temp_start($sql, $bind=array(), $options=array()) { function exec_db_temp_start($sql, $bind=array(), $options=array()) {
$_tablename = make_random_id(); $_tablename = make_random_id();
$_sql = sprintf("create temporary table if not exists %s as (%s)", $_tablename, get_db_binded_sql($sql, $bind)); $_sql = sprintf("create temporary table if not exists `%s` %s", $_tablename, get_db_binded_sql($sql, $bind));
write_common_log($_sql);
return (exec_db_query($_sql) ? $_tablename : false); return (exec_db_query($_sql) ? $_tablename : false);
} }
} }