第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

pdo_helper數(shù)據(jù)庫(kù)PDO操作類(lèi)(未精簡(jiǎn))第二部分

????/*
????*????@function?解析where條件數(shù)組
????*????@param?$where?where條件數(shù)組
????*????@return?array
????*????@notice?只支持簡(jiǎn)單的條件語(yǔ)句
????*????$where的數(shù)據(jù)結(jié)構(gòu)如下
????????$where=array(
????????????array("id",">","3"),
????????????array("id","<","10"),
????????);
????*/
????public?function?analyzeWhere($where){
????????$arr=array();
????????if(!is_array($where)||empty($where)){
????????????$arr["str"]="";
????????????$arr["value_arr"]=array();
????????}
????????else{
????????????
????????????$where_arr=array();
????????????$where_value_arr=array();
????????????foreach($where?as?$key=>$value){
????????????????if(count($value)==3){
????????????????????if($value[1]=="in"){
????????????????????????if(empty($value[2])){
????????????????????????????continue;
????????????????????????}
????????????????????????else{
????????????????????????????$where_arr[]=?"`".$value[0]."`?".$val[1]."?('".implode("','",$value[2])."')?";
????????????????????????}
????????????????????}
????????????????????else?if($value[1]=="like"){
????????????????????????$where_arr[]="`".$value[0]."`?".$value[1]."?'%".$value[2]."%'?";
????????????????????}
????????????????????else{
????????????????????????
????????????????????????$where_arr[]="`".$value[0]."`?".$value[1]."???";
????????????????????????if(is_numeric($value[2])){
????????????????????????????$where_value_arr[]=$value[2];
????????????????????????}
????????????????????????else{
????????????????????????????$where_value_arr[]='\''.$value[2]."\'";
????????????????????????}
????????????????????}
????????????????}
????????????}
????????????$arr["str"]=!empty($where_arr)???"?WHERE?".implode("?and?",$where_arr)?:?"";
????????????$arr["value_arr"]=$where_value_arr;
????????}
????????return?$arr;
????}
????
????/*
????*????@function?解析group數(shù)組
????*????@param?$group?group數(shù)組
????*????@return?array
????*????@notice?group?by?后跟字段,所以不需要占位符
????????$group數(shù)據(jù)格式如下
????????$group=array(
????????????"id","ct",
????????);
????*/
????public?function?analyzeGroup($group){
????????$arr=array();
????????if(!is_array($group)||empty($group)){
????????????$arr["str"]="";
????????}
????????else{
????????????$groupArr=array();
????????????foreach($group?as?$key=>$value){
????????????????$groupArr[]=$value;
????????????}
????????????$str_group=implode(",",$groupArr);
????????????$arr["str"]="?GROUP?BY?".$str_group;
????????}
????????$arr["value_arr"]=array();
????????return?$arr;
????}

????/*
????*????@function?解析having數(shù)組
????*????@param?$having?having數(shù)組
????*????@return?array
????*????@notice
????????$having數(shù)據(jù)格式如下
????????$having=array(
????????????"id","=","6",
????????);
????*/
????public?function?analyzeHaving($having){
????????$arr=array();
????????if(!is_array($having)||empty($having)){
????????????$arr["str"]="";
????????}
????????else{
????????????$str_having="";
????????????foreach($having?as?$key=>$value){
????????????????$str_having.=$value."?";
????????????}
????????????$arr["str"]="?HAVING?".$str_having;
????????}
????????$arr["value_arr"]=array();
????????return?$arr;
????}

????/*
????*????@function?解析order數(shù)組
????*????@param?$order?order數(shù)組
????*????@return?array
????*????@notice?order?by?后跟字段所以不需要占位符
????????$order數(shù)據(jù)格式如下
????????$order=array(
????????????"id","ct",
????????);
????*/
????public?function?analyzeOrder($order){
????????$arr=array();
????????if(!is_array($order)||empty($order)){
????????????$arr["str"]="";
????????}
????????else{
????????????$orderArr=array();
????????????foreach($order?as?$key=>$value){
????????????????$orderArr[]=$value;
????????????}
????????????$str_order=implode(",",$orderArr);
????????????$arr["str"]="?ORDER?BY?".$str_order;
????????}
????????$arr["value_arr"]=array();
????????return?$arr;
????}

????/*
????*????@function?解析limit數(shù)組
????*????@param?$limit?limit數(shù)組
????*????@return?array
????*????@notice?$limit數(shù)據(jù)格式如下
????????$limit=array(
????????????"id","ct",
????????);
????*/
????public?function?analyzeLimit($limit){
????????$arr=array();
????????if(!is_array($limit)||empty($limit)){
????????????$arr["str"]="";
????????????$arr["value_arr"]=array();
????????}
????????else{
????????????$limitArr=array();
????????????$limitValueArr=array();
????????????foreach($limit?as?$key=>$value){
????????????????$limitArr[]="?";
????????????????$limitValueArr[]=$value;
????????????}
????????????$str_limit=implode(",",$limitArr);
????????????$arr["str"]="?LIMIT?".$str_limit;
????????????$arr["value_arr"]=$limitValueArr;
????????}
????????return?$arr;
????}
????
????/*
????*????@function?釋放結(jié)果集
????*/
????public?function?free(){
????????if($this->stmt){
????????????$this->stmt=null;
????????}
????}

????/*
????*????@function?斷開(kāi)連接
????*/
????public?function?close(){
????????if($this->conn){
????????????$this->conn=null;
????????}
????}
}
$dbhelper=new?pdo_dbhelper();
$result=$dbhelper->readAll("category",array("name"),array("where"=>array(array("id","=","3"))));
$dbhelper->free();
$dbhelper->close();
print_r($result);
?>

正在回答

舉報(bào)

0/150
提交
取消

pdo_helper數(shù)據(jù)庫(kù)PDO操作類(lèi)(未精簡(jiǎn))第二部分

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)