Skip to content

Commit

Permalink
适配mysqli begin
Browse files Browse the repository at this point in the history
  • Loading branch information
kiss291323003 committed Aug 30, 2024
1 parent 3ef21db commit d72fb28
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/FastDb.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ function recycleContext():void
* @throws RuntimeError
* @throws Exception
*/
function begin(?Connection $client = null,float $timeout = 3.0): bool
function begin(?Connection $client = null,float|int $timeout = 3.0): bool
{
if(!$client){
$client = $this->getClient();
Expand All @@ -184,7 +184,11 @@ function begin(?Connection $client = null,float $timeout = 3.0): bool

$t = microtime(true);
if($client->mysqlClient() instanceof \mysqli){
$ret = $client->mysqlClient()->begin_transaction();
if(is_int($timeout)){
$ret = $client->mysqlClient()->begin_transaction($timeout);
}else{
$ret = $client->mysqlClient()->begin_transaction();
}
}else{
$ret = $client->mysqlClient()->begin($timeout);
}
Expand Down

0 comments on commit d72fb28

Please sign in to comment.