Update database.php

This commit is contained in:
Namhyeon Go 2019-02-26 18:22:10 +09:00 committed by GitHub
parent 6295c19cbd
commit fc30285fd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -80,26 +80,23 @@ if(!check_function_exists("get_dbc_object")) {
} }
if(!check_function_exists("get_db_binded_param")) { if(!check_function_exists("get_db_binded_param")) {
function get_db_binded_param($expression, $bind) { function get_db_binded_param($exp, $bind) {
if($exp == (":" . $k)) {
foreach($bind as $k=>$v) { foreach($bind as $k=>$v) {
if($expression == (":" . $k)) { $exp = sprintf("'%s'", make_safe_argument($v));
$expression = sprintf("'%s'", make_safe_argument($v));
} }
} }
return $exp;
return $expression;
} }
} }
if(!check_function_exists("get_db_binded_sql")) { if(!check_function_exists("get_db_binded_sql")) {
function get_db_binded_sql($sql, $bind) { function get_db_binded_sql($sql, $bind) {
$d = explode(" ", $sql); $exps = multi_str_split($sql, array(" ", "<>", ">=", "<=", "=", "(", ")", "\r\n", "\n", "\t"));
foreach($d as $k=>$v) { foreach($exps as $k=>$v) {
$d[$k] = get_db_binded_param($v, $bind); $exps[$k] = get_db_binded_param($v, $bind);
} }
$sql = implode(" ", $d); return implode("", $exps);
return $sql;
} }
} }