Skip to content

Commit d2ca5ad

Browse files
committed
rename coroutine class
Signed-off-by: XieBiao <[email protected]>
1 parent f99a177 commit d2ca5ad

File tree

5 files changed

+12
-18
lines changed

5 files changed

+12
-18
lines changed

src/Illuminate/Database/ConnectionFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ protected function createConnection($driver, $connection, $database, $prefix = '
2424
{
2525
switch ($driver) {
2626
case 'sw-co-mysql':
27-
return new CoroutineMySQLConnection($connection, $database, $prefix, $config);
27+
return new SwooleMySQLConnection($connection, $database, $prefix, $config);
2828
}
2929
return parent::createConnection($driver, $connection, $database, $prefix, $config);
3030
}

src/Illuminate/Database/Connectors/CoroutineMySQLConnector.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Illuminate\Support\Arr;
66
use Illuminate\Database\Connectors\Connector;
77
use Illuminate\Database\Connectors\ConnectorInterface;
8-
use Hhxsv5\LaravelS\Illuminate\Database\CoroutineMySQL;
8+
use Hhxsv5\LaravelS\Illuminate\Database\SwoolePDO;
99
use Illuminate\Support\Str;
1010

1111
class CoroutineMySQLConnector extends Connector implements ConnectorInterface
@@ -14,7 +14,7 @@ class CoroutineMySQLConnector extends Connector implements ConnectorInterface
1414
* @param string $dsn
1515
* @param array $config
1616
* @param array $options
17-
* @return CoroutineMySQL
17+
* @return SwoolePDO
1818
* @throws \Throwable
1919
*/
2020
public function createConnection($dsn, array $config, array $options)
@@ -31,7 +31,7 @@ public function createConnection($dsn, array $config, array $options)
3131
/**
3232
* @param \Throwable $e
3333
* @param array $config
34-
* @return CoroutineMySQL
34+
* @return SwoolePDO
3535
* @throws \Throwable
3636
*/
3737
protected function _tryAgainIfCausedByLostConnection($e, array $config)
@@ -44,11 +44,11 @@ protected function _tryAgainIfCausedByLostConnection($e, array $config)
4444

4545
/**
4646
* @param array $config
47-
* @return CoroutineMySQL
47+
* @return SwoolePDO
4848
*/
4949
public function connect(array $config)
5050
{
51-
$connection = new CoroutineMySQL();
51+
$connection = new SwoolePDO();
5252
$connection->connect([
5353
'host' => Arr::get($config, 'host', '127.0.0.1'),
5454
'port' => Arr::get($config, 'port', 3306),

src/Illuminate/Database/CoroutineMySQLConnection.php renamed to src/Illuminate/Database/SwooleMySQLConnection.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,24 @@
44

55
use Illuminate\Database\MySqlConnection;
66

7-
class CoroutineMySQLConnection extends MySqlConnection
7+
class SwooleMySQLConnection extends MySqlConnection
88
{
99
/**
1010
* The active swoole mysql connection.
1111
*
12-
* @var CoroutineMySQL
12+
* @var SwoolePDO
1313
*/
1414
protected $pdo;
1515

1616
/**
1717
* The active swoole mysql used for reads.
1818
*
19-
* @var CoroutineMySQL
19+
* @var SwoolePDO
2020
*/
2121
protected $readPdo;
2222

2323
public function getDriverName()
2424
{
2525
return 'Swoole Coroutine MySQL';
2626
}
27-
//
28-
// protected function prepared($statement)
29-
// {
30-
// //TODO
31-
// return $statement;
32-
// }
3327
}

src/Illuminate/Database/CoroutineMySQL.php renamed to src/Illuminate/Database/SwoolePDO.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Illuminate\Database\QueryException;
66
use Swoole\Coroutine\MySQL as SwooleMySQL;
77

8-
class CoroutineMySQL extends \PDO
8+
class SwoolePDO extends \PDO
99
{
1010
protected $coMySQL;
1111

@@ -25,7 +25,7 @@ public function prepare($statement, $options = null)
2525
if ($oldStatement === false) {
2626
throw new QueryException($statement, [], new \Exception($this->coMySQL->error, $this->coMySQL->errno));
2727
}
28-
return new CoroutineMySQLStatement($oldStatement);
28+
return new SwoolePDOStatement($oldStatement);
2929
}
3030

3131
public function beginTransaction()

src/Illuminate/Database/CoroutineMySQLStatement.php renamed to src/Illuminate/Database/SwoolePDOStatement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Swoole\Coroutine\MySQL\Statement as SwooleStatement;
66

7-
class CoroutineMySQLStatement extends \PDOStatement
7+
class SwoolePDOStatement extends \PDOStatement
88
{
99
protected $statement;
1010
protected $bindParams = [];

0 commit comments

Comments
 (0)