Update database.php

This commit is contained in:
Namhyeon Go 2019-12-31 17:01:05 +09:00 committed by GitHub
parent f0a2e731c0
commit ca4a0d7a37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -484,7 +484,7 @@ if(!check_function_exists("get_bind_to_sql_update_set")) {
if(!check_function_exists("get_bind_to_sql_select")) { if(!check_function_exists("get_bind_to_sql_select")) {
// warning: variable k is not protected. do not use variable k and external variable without filter // warning: variable k is not protected. do not use variable k and external variable without filter
function get_bind_to_sql_select($tablename, $bind=array(), $options=array()) { function get_bind_to_sql_select($tablename, $bind=array(), $options=array()) {
$sql = "select %s from %s where %s %s %s"; $sql = "select %s from `%s` where %s %s %s";
// db_separated_tables: check it is seperated table // db_separated_tables: check it is seperated table
$config = get_config(); $config = get_config();
@ -773,10 +773,10 @@ if(!check_function_exists("exec_db_table_create")) {
// check if exists table // check if exists table
$bind = array( $bind = array(
"table_schema" => $config['db_name'], "TABLE_SCHEMA" => $config['db_name'],
"table_name" => $_tablename "TABLE_NAME" => $_tablename
); );
$sql = get_bind_to_sql_select("information_schema.tables", $bind); $sql = "select TABLE_NAME from information_schema.tables where TABLE_SCHEMA = :TABLE_SCHEMA and TABLE_NAME = :TABLE_NAME";
$rows = exec_db_fetch_all($sql, $bind); $rows = exec_db_fetch_all($sql, $bind);
foreach($rows as $row) { foreach($rows as $row) {
return $row['TABLE_NAME']; return $row['TABLE_NAME'];