From 3b187f6cd46b467870b627cd4f73f074782224b6 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Mon, 27 Jan 2020 14:36:15 +0900 Subject: [PATCH] Update database.php --- system/database.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/system/database.php b/system/database.php index 63c5bd2..d59a4c3 100644 --- a/system/database.php +++ b/system/database.php @@ -494,13 +494,14 @@ if(!check_function_exists("check_table_is_separated")) { } if(!check_function_exists("get_db_tablenames")) { - function get_db_tablenames($tablename) { + function get_db_tablenames($tablename, $end_dt="", $start_dt="") { $tablenames = array(); $is_separated = check_table_is_separated($tablename); if(!$is_separated) { $tablenames[] = $tablename; } else { + $sql = sprintf("select table_name from `%s.tables` order by datetime desc", $tablename); $rows = exec_db_fetch_all($sql); foreach($rows as $row) { @@ -908,10 +909,13 @@ if(!check_function_exists("exec_db_table_create")) { } if(!check_function_exists("exec_db_table_drop")) { - function exec_db_table_drop($tablename) { + function exec_db_table_drop($tablename, $options=array()) { $flag = true; - - $tablenames = get_db_tablenames($tablename); + + $end_dt = get_value_in_array("end_dt", $options, ""); + $start_dt = get_value_in_array("start_dt", $options, ""); + + $tablenames = get_db_tablenames($tablename, $end_dt, $start_dt); foreach($tablenames as $_tablename) { $sql = sprintf("drop table `%s`", $_tablename); $flag &= exec_db_query($sql);