Skip to content

Commit d5d6127

Browse files
committed
revert last commit
1 parent 2153783 commit d5d6127

File tree

2 files changed

+7
-40
lines changed

2 files changed

+7
-40
lines changed

src/Ubiquity/db/providers/swoole/SwoolePoolWrapper.php

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/Ubiquity/db/providers/swoole/SwooleWrapper.php

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,29 @@
22
namespace Ubiquity\db\providers\swoole;
33

44
use Ubiquity\db\providers\AbstractDbWrapper;
5-
use Swoole\Coroutine\MySQL;
5+
use Ubiquity\db\providers\TraitHasPool;
66

77
/**
88
* Ubiquity\db\providers\swoole$SwooleWrapper
99
* This class is part of Ubiquity
1010
* @author jcheron <[email protected]>
11-
* @version 1.0.1
11+
* @version 1.0.0
1212
* @property \Swoole\Coroutine\MySQL $dbInstance
1313
*
1414
*/
1515
class SwooleWrapper extends AbstractDbWrapper {
16+
use TraitHasPool;
1617

1718
private $inTransaction=false;
1819

1920
public function __construct($dbType = 'mysql') {
2021
$this->quote = '`';
2122
}
2223

24+
public function getPoolClass() {
25+
return \Ubiquity\db\pooling\ConnectionPool::class;
26+
}
27+
2328
public function queryColumn($sql, $columnNumber = null) {
2429
$stmt = $this->getInstance()->prepare($sql);
2530
if($stmt->execute()){
@@ -154,23 +159,5 @@ public function executeStatement($statement, array $values = null) {
154159

155160
public function getPrimaryKeys($tableName) {}
156161

157-
public function connect(string $dbType, $dbName, $serverName, string $port, string $user, string $password, array $options) {
158-
$uid=\Swoole\Coroutine::getuid();
159-
if(!isset($this->dbInstance[$uid])){
160-
$db=new MySQL();
161-
$server = [
162-
'charset' => 'utf8mb4',
163-
'timeout' => 1.000,
164-
'strict_type' => true
165-
];
166-
$db->connect(['host'=>$serverName??'127.0.0.1','port'=>$port??3306,'user'=>$user??'root','password'=>$password??'','database'=>$dbName??'']+$server);
167-
$this->dbInstance[$uid]=$db;
168-
}
169-
}
170-
171-
public function getDbInstance() {
172-
return $this->dbInstance[\Swoole\Coroutine::getuid()];
173-
}
174-
175162
}
176163

0 commit comments

Comments
 (0)