Update database.php
This commit is contained in:
parent
7b6dde0460
commit
8c93ea1629
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* @file database.php
|
* @file database.php
|
||||||
* @created_on 2018-04-13
|
* @created_on 2018-04-13
|
||||||
* @updated_on 2020-02-20
|
* @updated_on 2020-03-25
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <gnh1201@gmail.com>
|
||||||
* @brief Database module
|
* @brief Database module
|
||||||
*/
|
*/
|
||||||
|
@ -933,13 +933,18 @@ if(!is_fn("exec_db_table_create")) {
|
||||||
$_tablename_s = sprintf("%s%s", $tablename, $_suffix);
|
$_tablename_s = sprintf("%s%s", $tablename, $_suffix);
|
||||||
$_tablename_t = sprintf("%s.tables", $_tablename_p);
|
$_tablename_t = sprintf("%s.tables", $_tablename_p);
|
||||||
|
|
||||||
// get index options
|
// get global configuration
|
||||||
$config = get_config();
|
$config = get_config();
|
||||||
|
|
||||||
|
// get index options
|
||||||
$setindex = get_value_in_array("setindex", $options, false);
|
$setindex = get_value_in_array("setindex", $options, false);
|
||||||
$setunique = get_value_in_array("setunique", $options, false);
|
$setunique = get_value_in_array("setunique", $options, false);
|
||||||
$setfulltext = get_value_in_array("setfulltext", $options, false);
|
$setfulltext = get_value_in_array("setfulltext", $options, false);
|
||||||
$setspatial = get_value_in_array("setspatial", $options, false);
|
$setspatial = get_value_in_array("setspatial", $options, false);
|
||||||
|
|
||||||
|
// get event options
|
||||||
|
$setevent = get_value_in_array("setevent", $options, false);
|
||||||
|
|
||||||
// check if exists table
|
// check if exists table
|
||||||
$bind = array(
|
$bind = array(
|
||||||
"TABLE_SCHEMA" => $config['db_name'],
|
"TABLE_SCHEMA" => $config['db_name'],
|
||||||
|
@ -1008,6 +1013,12 @@ if(!is_fn("exec_db_table_create")) {
|
||||||
$sql = sprintf("create spatial index `%s` on `%s` (%s)", $k, $_tablename, implode(", ", $v));
|
$sql = sprintf("create spatial index `%s` on `%s` (%s)", $k, $_tablename, implode(", ", $v));
|
||||||
exec_db_query($sql);
|
exec_db_query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// create event
|
||||||
|
foreach($setevent as $event) {
|
||||||
|
$sql = sprintf("create event `%s` on schedule at CURRENT_TIMESTAMP + INTERVAL %s MINUTES DO %s", $_tablename, $event['interval'], $event['query']);
|
||||||
|
exec_db_query($sql);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $_tablename;
|
return $_tablename;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user