Skip to content

Commit

Permalink
<=> change to =,效率问题
Browse files Browse the repository at this point in the history
  • Loading branch information
hetao29 committed Nov 19, 2024
1 parent 5a66a1f commit fba5662
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions plugins/db/Db.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public function select($table,$condition="",$item="",$groupby="",$orderby="",$le
$params=[];
$condition_str="";
if(!empty($condition)){
$condition_str = "WHERE ".$this->buildsql($condition, "<=>", false, true, "AND",$params);
$condition_str = "WHERE ".$this->buildsql($condition, "=", false, true, "AND",$params);
}
//ITEM
if(!empty($item)){
Expand Down Expand Up @@ -256,7 +256,7 @@ public function update($table,$condition,$item){
$params=[];
$params2=[];
$value = $this->buildsql($item, "=", false, true, ",",$params);
$condition_str = $this->buildsql($condition, "<=>", false, true, "AND",$params2);
$condition_str = $this->buildsql($condition, "=", false, true, "AND",$params2);
if($condition_str!=""){
$condition_str=" WHERE ".$condition_str;
}
Expand All @@ -273,7 +273,7 @@ public function update($table,$condition,$item){
public function delete($table,$condition){
$table = $this->buildsql($table, "AS");
$params=[];
$condition_str = $this->buildsql($condition, "<=>", false, true, "AND",$params);
$condition_str = $this->buildsql($condition, "=", false, true, "AND",$params);
if($condition_str!=""){
$condition_str=" WHERE ".$condition_str;
}
Expand Down Expand Up @@ -412,6 +412,10 @@ private function buildsql($mixed, $split="", $revert=true, $alias=true, $joinfla
[$v,$k] = [$k,$v]; //swap
}
if($return_params!==NULL){
if($v===NULL && $joinflag=="AND"){
$tmp[]="$k IS NULL";
continue;
}
$return_params[]=$v;
$v="?";
}
Expand Down

0 comments on commit fba5662

Please sign in to comment.