8000 Rename `QueryResult` to `MysqlResult` · friends-of-reactphp/mysql@882a03f · GitHub
[go: up one dir, main page]

Skip to content

Commit 882a03f

Browse files
committed
Rename QueryResult to MysqlResult
1 parent 9e01898 commit 882a03f

File tree

9 files changed

+49
-49
lines changed

9 files changed

+49
-49
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ require __DIR__ . '/vendor/autoload.php';
4747
$mysql = new React\MySQL\MysqlClient('user:pass@localhost/bookstore');
4848

4949
$mysql->query('SELECT * FROM book')->then(
50-
function (React\MySQL\QueryResult $command) {
50+
function (React\MySQL\MysqlResult $command) {
5151
print_r($command->resultFields);
5252
print_r($command->resultRows);
5353
echo count($command->resultRows) . ' row(s) in set' . PHP_EOL;
@@ -202,10 +202,10 @@ given event loop instance.
202202

203203
#### query()
204204

205-
The `query(string $query, array $params = []): PromiseInterface<QueryResult>` method can be used to
205+
The `query(string $query, array $params = []): PromiseInterface<MysqlResult>` method can be used to
206206
perform an async query.
207207

208-
This method returns a promise that will resolve with a `QueryResult` on
208+
This method returns a promise that will resolve with a `MysqlResult` on
209209
success or will reject with an `Exception` on error. The MySQL protocol
210210
is inherently sequential, so that all queries will be performed in order
211211
and outstanding queries will be put into a queue to be executed once the
@@ -225,7 +225,7 @@ unknown or known to be too large to fit into memory, you should use the
225225
[`queryStream()`](#querystream) method instead.
226226

227227
```php
228-
$mysql->query($query)->then(function (QueryResult $command) {
228+
$mysql->query($query)->then(function (React\MySQL\MysqlResult $command) {
229229
if (isset($command->resultRows)) {
230230
// this is a response to a SELECT etc. with some rows (0+)
231231
print_r($command->resultFields);

examples/01-query.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
$mysql = new React\MySQL\MysqlClient(getenv('MYSQL_URI') ?: 'test:test@localhost/test');
99

1010
$query = isset($argv[1]) ? $argv[1] : 'select * from book';
11-
$mysql->query($query)->then(function (React\MySQL\QueryResult $command) {
11+
$mysql->query($query)->then(function (React\MySQL\MysqlResult $command) {
1212
if (isset($command->resultRows)) {
1313
// this is a response to a SELECT etc. with some rows (0+)
1414
print_r($command->resultFields);

examples/11-interactive.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
}
2626

2727
$time = microtime(true);
28-
$mysql->query($query)->then(function (React\MySQL\QueryResult $command) use ($time) {
28+
$mysql->query($query)->then(function (React\MySQL\MysqlResult $command) use ($time) {
2929
if (isset($command->resultRows)) {
3030
// this is a response to a SELECT etc. with some rows (0+)
3131
echo implode("\t", array_column($command->resultFields, 'name')) . PHP_EOL;

src/Io/Connection.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use React\MySQL\Commands\QueryCommand;
99
use React\MySQL\Commands\QuitCommand;
1010
use React\MySQL\Exception;
11-
use React\MySQL\QueryResult;
11+
use React\MySQL\MysqlResult;
1212
use React\Promise\Deferred;
1313
use React\Promise\Promise;
1414
use React\Socket\ConnectionInterface as SocketConnectionInterface;
@@ -79,7 +79,7 @@ public function query($sql, array $params = [])
7979
$rows[] = $row;
8080
});
8181
$command->on('end', function () use ($command, $deferred, &$rows) {
82-
$result = new QueryResult();
82+
$result = new MysqlResult();
8383
$result->resultFields = $command->fields;
8484
$result->resultRows = $rows;
8585
$result->warningCount = $command->warningCount;
@@ -94,7 +94,7 @@ public function query($sql, array $params = [])
9494
$deferred->reject($error);
9595
});
9696
$command->on('success', function () use ($command, $deferred) {
97-
$result = new QueryResult();
97+
$result = new MysqlResult();
9898
$result->affectedRows = $command->affectedRows;
9999
$result->insertId = $command->insertId;
100100
$result->warningCount = $command->warningCount;

src/MysqlClient.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ function () use ($connection) {
151151
/**
152152
* Performs an async query.
153153
*
154-
* This method returns a promise that will resolve with a `QueryResult` on
154+
* This method returns a promise that will resolve with a `MysqlResult` on
155155
* success or will reject with an `Exception` on error. The MySQL protocol
156156
* is inherently sequential, so that all queries will be performed in order
157157
* and outstanding queries will be put into a queue to be executed once the
@@ -171,7 +171,7 @@ function () use ($connection) {
171171
* [`queryStream()`](#querystream) method instead.
172172
*
173173
* ```php
174-
* $mysql->query($query)->then(function (QueryResult $command) {
174+
* $mysql->query($query)->then(function (MysqlResult $command) {
175175
* if (isset($command->resultRows)) {
176176
* // this is a response to a SELECT etc. with some rows (0+)
177177
* print_r($command->resultFields);
@@ -204,8 +204,8 @@ function () use ($connection) {
204204
*
205205
* @param string $sql SQL statement
206206
* @param array $params Parameters which should be bound to query
207-
* @return PromiseInterface<QueryResult>
208-
* Resolves with a `QueryResult` on success or rejects with an `Exception` on error.
207+
* @return PromiseInterface<MysqlResult>
208+
* Resolves with a `MysqlResult` on success or rejects with an `Exception` on error.
209209
*/
210210
public function query($sql, array $params = [])
211211
{
@@ -216,7 +216,7 @@ public function query($sql, array $params = [])
216216
return $this->connecting()->then(function (Connection $connection) use ($sql, $params) {
217217
$this->awake();
218218
return $connection->query($sql, $params)->then(
219-
function (QueryResult $result) {
219+
function (MysqlResult $result) {
220220
$this->idle();
221221
return $result;
222222
},

src/QueryResult.php renamed to src/MysqlResult.php

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

33
namespace React\MySQL;
44

5-
class QueryResult
5+
class MysqlResult
66
{
77
/**
88
* last inserted ID (if any)

tests/MysqlClientTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use React\MySQL\Io\Connection;
66
use React\MySQL\MysqlClient;
7-
use React\MySQL\QueryResult;
7+
use React\MySQL\MysqlResult;
88
use React\Promise\Deferred;
99
use React\Promise\Promise;
1010
use React\Promise\PromiseInterface;
@@ -308,7 +308,7 @@ public function testQueryWillQueryUnderlyingConnectionWhenResolved()
308308

309309
public function testQueryWillResolveAndStartTimerWithDefaultIntervalWhenQueryFromUnderlyingConnectionResolves()
310310
{
311-
$result = new QueryResult();
311+
$result = new MysqlResult();
312312

313313
$base = $this->getMockBuilder('React\MySQL\Io\Connection')->disableOriginalConstructor()->getMock();
314314
$base->expects($this->once())->method('query')->with('SELECT 1')->willReturn(\React\Promise\resolve($result));
@@ -331,7 +331,7 @@ public function testQueryWillResolveAndStartTimerWithDefaultIntervalWhenQueryFro
331331

332332
public function testQueryWillResolveAndStartTimerWithIntervalFromIdleParameterWhenQueryFromUnderlyingConnectionResolves()
333333
{
334-
$result = new QueryResult();
334+
$result = new MysqlResult();
335335

336336
$base = $this->getMockBuilder('React\MySQL\Io\Connection')->disableOriginalConstructor()->getMock();
337337
$base->expects($this->once())->method('query')->with('SELECT 1')->willReturn(\React\Promise\resolve($result));
@@ -354,7 +354,7 @@ public function testQueryWillResolveAndStartTimerWithIntervalFromIdleParameterWh
354354

355355
public function testQueryWillResolveWithoutStartingTimerWhenQueryFromUnderlyingConnectionResolvesAndIdleParameterIsNegative()
356356
{
357-
$result = new QueryResult();
357+
$result = new MysqlResult();
358358

359359
$base = $this->getMockBuilder('React\MySQL\Io\Connection')->disableOriginalConstructor()->getMock();
360360
$base->expects($this->once())->method('query')->with('SELECT 1')->willReturn(\React\Promise\resolve($result));
@@ -377,7 +377,7 @@ public function testQueryWillResolveWithoutStartingTimerWhenQueryFromUnderlyingC
377377

378378
public function testQueryBeforePingWillResolveWithoutStartingTimerWhenQueryFromUnderlyingConnectionResolvesBecausePingIsStillPending()
379379
{
380-
$result = new QueryResult();
380+
$result = new MysqlResult();
381381
$deferred = new Deferred();
382382

383383
$base = $this->getMockBuilder('React\MySQL\Io\Connection')->disableOriginalConstructor()->getMock();

tests/NoResultQueryTest.php

Lines changed: 5 additions & 5 deletions
< 409F td data-grid-cell-id="diff-97658b6b9a5c2d5f46c47043bffe89790cedbb5901417f82cca225047cc8b268-80-80-1" data-selected="false" role="gridcell" style="background-color:var(--bgColor-default);text-align:center" tabindex="-1" valign="top" class="focusable-grid-cell diff-line-number position-relative diff-line-number-neutral left-side">80
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use React\EventLoop\Loop;
66
use React\MySQL\MysqlClient;
7-
use React\MySQL\QueryResult;
7+
use React\MySQL\MysqlResult;
88

99
class NoResultQueryTest extends BaseTestCase
1010
{
@@ -27,7 +27,7 @@ public function testUpdateSimpleNonExistentReportsNoAffectedRows()
2727
{
2828
$connection = $this->createConnection(Loop::get());
2929

30-
$connection->query('update book set created=999 where id=999')->then(function (QueryResult $command) {
30+
$connection->query('update book set created=999 where id=999')->then(function (MysqlResult $command) {
3131
$this->assertEquals(0, $command->affectedRows);
3232
});
3333

@@ -39,7 +39,7 @@ public function testInsertSimpleReportsFirstInsertId()
3939
{
4040
$connection = $this->createConnection(Loop::get());
4141

42-
$connection->query("insert into book (`name`) values ('foo')")->then(function (QueryResult $command) {
42+
$connection->query("insert into book (`name`) values ('foo')")->then(function (MysqlResult $command) {
4343
$this->assertEquals(1, $command->affectedRows);
4444
$this->assertEquals(1, $command->insertId);
4545
});
@@ -53,7 +53,7 @@ public function testUpdateSimpleReportsAffectedRow()
5353
$connection = $this->createConnection(Loop::get());
5454

5555
$connection->query("insert into book (`name`) values ('foo')");
56-
$connection->query('update book set created=999 where id=1')->then(function (QueryResult $command) {
56+
$connection->query('update book set created=999 where id=1')->then(function (MysqlResult $command) {
5757
$this->assertEquals(1, $command->affectedRows);
5858
});
5959

@@ -75,7 +75,7 @@ public function testCreateTableAgainWillAddWarning()
7575
PRIMARY KEY (`id`)
7676
)';
7777

78-
$connection->query($sql)->then(function (QueryResult $command) {
78+
$connection->query($sql)->then(function (MysqlResult $command) {
7979
$this->assertEquals(1, $command->warningCount);
80
});
8181

0 commit comments

Comments
 (0)
0