From 587a16664ea15da0d56fb80109296514f89d1f81 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Tue, 11 Sep 2018 11:42:16 +0900 Subject: [PATCH] Create database.mysql.imp.php --- helper/database.mysql.imp.php | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 helper/database.mysql.imp.php diff --git a/helper/database.mysql.imp.php b/helper/database.mysql.imp.php new file mode 100644 index 0000000..2755001 --- /dev/null +++ b/helper/database.mysql.imp.php @@ -0,0 +1,36 @@ + + * @brief MySQLi database helper + */ + +if(!function_exists("get_db_mysql_imp_connect")) { + function get_db_mysql_imp_connect() { + $conn = false; + $config = get_config(); + + $conn = @mysqli_connect($config['db_host'], $config['db_username'], $config['db_password'], $config['db_name']); + + $errno = @mysqli_connect_errno(); + if($errno) { + set_error(sprintf("Failed to connect to MySQL: %s", $errno)); + show_errors(); + } + + return $conn; + } +} + +if(!function_exists("exec_db_mysql_imp_query")) { + function exec_db_mysql_imp_query($sql, $bind) { + $result = false; + $dbc = get_dbc_object(); + + $binded_sql = get_db_binded_sql($sql, $bind); + $result = @mysqli_query($dbc, $binded_sql); + + return $result; + } +}