Skip to content

Commit

Permalink
适配swoole 5.x在8.3下废弃协程Mysqli客户端
Browse files Browse the repository at this point in the history
  • Loading branch information
kiss291323003 committed Nov 28, 2023
1 parent a619854 commit e297a99
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function query(QueryBuilder $builder,float $timeout = null)
if($this->config->isUseMysqli()){
$stmt = $this->mysqlClient()->prepare($builder->getLastPrepareQuery());
if(!$stmt){
throw new Exception("prepare {$builder->getLastPrepareQuery()} fail");
throw new Exception("prepare {$builder->getLastPrepareQuery()} fail");
}
$p = '';
foreach ($builder->getLastBindParams() as $item){
Expand All @@ -63,9 +63,9 @@ function query(QueryBuilder $builder,float $timeout = null)
$ret = $stmt->get_result();
if($ret instanceof mysqli_result){
$ret = $ret->fetch_all(MYSQLI_ASSOC);
$this->lastInsertId = $stmt->insert_id;
$this->lastAffectRows = $stmt->affected_rows;
}
$this->lastInsertId = $stmt->insert_id;
$this->lastAffectRows = $stmt->affected_rows;
$stmt->close();
}else{
$stmt = $this->mysqlClient()->prepare($builder->getLastPrepareQuery(),$timeout);
Expand Down Expand Up @@ -106,10 +106,10 @@ function rawQuery(string $query,float $timeout = null)
if($this->config->isUseMysqli()){
$ret = $this->mysqlClient()->query($query);
if($ret instanceof mysqli_result){
$this->lastInsertId = $this->mysqlClient()->insert_id;
$this->lastAffectRows = $this->mysqlClient()->affected_rows;
$ret = $ret->fetch_all(MYSQLI_ASSOC);
}
$this->lastInsertId = $this->mysqlClient()->insert_id;
$this->lastAffectRows = $this->mysqlClient()->affected_rows;
}else{
$ret = $this->mysqlClient()->query($query,$timeout);
$this->lastInsertId = $this->mysqlClient()->insert_id;
Expand Down

0 comments on commit e297a99

Please sign in to comment.