Update database.php

This commit is contained in:
Namhyeon Go 2018-02-12 14:58:54 +09:00 committed by GitHub
parent 3e7cc10501
commit 015a5c2e35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,11 +26,13 @@ if(!function_exists("sql_query")) {
}
}
function get_dbc_object() {
global $dbc;
return $dbc;
}
function get_db_stmt($sql, $bind=array()) {
global $dbc;
$stmt = $dbc->prepare($sql);
$stmt = get_dbc_object()->prepare($sql);
if(count($bind) > 0) {
foreach($bind as $k=>$v) {
$stmt->bindParam(':' . $k, $v);
@ -40,17 +42,15 @@ function get_db_stmt($sql, $bind=array()) {
}
function get_db_last_id() {
global $dbc;
return $dbc->lastInsertId();
return get_dbc_object()->lastInsertId();
}
function exec_db_query($sql, $bind=array(), $options=array()) {
global $dbc;
$dbc = get_dbc_object();
$flag = false;
$stmt = get_db_stmt($sql, $bind);
$validOptions = array();
$optionAvailables = array("is_check_count", "is_commit");
foreach($optionAvailables as $opt) {