Update database.php
This commit is contained in:
parent
311ff54ba8
commit
5555711b6c
|
@ -189,15 +189,34 @@ if(!function_exists("get_page_range")) {
|
||||||
|
|
||||||
if(!function_exists("get_bind_to_sql_where")) {
|
if(!function_exists("get_bind_to_sql_where")) {
|
||||||
// warning: variable k is not protected. do not use variable k and external variable without filter
|
// warning: variable k is not protected. do not use variable k and external variable without filter
|
||||||
function get_bind_to_sql_where($bind) {
|
function get_bind_to_sql_where($bind, $excludes=array()) {
|
||||||
$sql_where = "";
|
$sql_where = "";
|
||||||
foreach($bind as $k=>$v) {
|
foreach($bind as $k=>$v) {
|
||||||
$sql_where .= " and {$k} = :{$k}";
|
if(!in_array($k, $excludes)) {
|
||||||
|
$sql_where .= " and {$k} = :{$k}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $sql_where;
|
return $sql_where;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!function_exists("get_bind_to_sql_update_set")) {
|
||||||
|
// warning: variable k is not protected. do not use variable k and external variable without filter
|
||||||
|
function get_bind_to_sql_update_set($bind, $excludes=array()) {
|
||||||
|
$sql_update_set = "";
|
||||||
|
|
||||||
|
$set_items = "";
|
||||||
|
foreach($bind as $k=>$v) {
|
||||||
|
if(!in_array($k, $excludes)) {
|
||||||
|
$set_items[] = "{$k}=:{$k}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$sql_update_set = implode(", ", $set_items);
|
||||||
|
|
||||||
|
return $sql_update_set;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// alias sql_query from exec_db_query
|
// alias sql_query from exec_db_query
|
||||||
if(!function_exists("sql_query")) {
|
if(!function_exists("sql_query")) {
|
||||||
function sql_query($sql, $bind=array()) {
|
function sql_query($sql, $bind=array()) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user