From 5c7f94a354478fbbc683b571599ae17ade064c42 Mon Sep 17 00:00:00 2001 From: prolic Date: Sat, 15 Sep 2018 21:12:51 +0800 Subject: [PATCH 1/5] Need fix after amphp/sql update resolves https://github.com/amphp/postgres/issues/15 --- composer.json | 1 + src/Connection.php | 6 +++--- test/AbstractLinkTest.php | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index f8d3f27..4538b66 100644 --- a/composer.json +++ b/composer.json @@ -19,6 +19,7 @@ } ], "require": { + "php": "^7.0", "amphp/amp": "^2", "amphp/sql": "dev-master" }, diff --git a/src/Connection.php b/src/Connection.php index f8cf662..de9275c 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -55,13 +55,13 @@ final public function isAlive(): bool * * @throws FailureException */ - final public function lastUsedAt(): int + final public function getLastUsedAt(): int { if (! $this->handle) { throw new FailureException('Not connected'); } - return $this->handle->lastUsedAt(); + return $this->handle->getLastUsedAt(); } /** @@ -183,7 +183,7 @@ final public function listen(string $channel): Promise * * @throws FailureException */ - final public function transaction(int $isolation = Transaction::ISOLATION_COMMITTED): Promise + final public function beginTransaction(int $isolation = Transaction::ISOLATION_COMMITTED): Promise { if (! $this->handle) { throw new FailureException('Not connected'); diff --git a/test/AbstractLinkTest.php b/test/AbstractLinkTest.php index a89361c..6668e5c 100644 --- a/test/AbstractLinkTest.php +++ b/test/AbstractLinkTest.php @@ -581,7 +581,7 @@ public function testTransaction() $isolation = SqlTransaction::ISOLATION_COMMITTED; /** @var \Amp\Postgres\Transaction $transaction */ - $transaction = yield $this->connection->transaction($isolation); + $transaction = yield $this->connection->beginTransaction($isolation); $this->assertInstanceOf(Transaction::class, $transaction); From ed0e19d4960ed323333468f4a4cbc3442a2e20ea Mon Sep 17 00:00:00 2001 From: prolic Date: Sat, 15 Sep 2018 21:29:47 +0800 Subject: [PATCH 2/5] Need fix after amphp/sql update #2 resolves https://github.com/amphp/postgres/issues/15 --- src/Connection.php | 2 +- src/ConnectionTransaction.php | 8 ++++---- src/PgSqlCommandResult.php | 4 ++-- src/PgSqlHandle.php | 2 +- src/PgSqlResultSet.php | 18 +++++++----------- src/PgSqlStatement.php | 5 +---- src/PooledResultSet.php | 4 ++-- src/PqBufferedResultSet.php | 14 +++++--------- src/PqCommandResult.php | 2 +- src/PqHandle.php | 2 +- src/PqStatement.php | 2 +- src/PqUnbufferedResultSet.php | 12 ++++-------- src/ResultSet.php | 2 +- test/AbstractLinkTest.php | 20 ++++++++++---------- 14 files changed, 41 insertions(+), 56 deletions(-) diff --git a/src/Connection.php b/src/Connection.php index de9275c..f1b4b76 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -213,7 +213,7 @@ final public function beginTransaction(int $isolation = Transaction::ISOLATION_C $this->busy = new Deferred; - return new ConnectionTransaction($this->handle, $isolation, $this->release); + return new ConnectionTransaction($this->handle, $this->release, $isolation); }); } diff --git a/src/ConnectionTransaction.php b/src/ConnectionTransaction.php index 3171ebc..1558e1b 100644 --- a/src/ConnectionTransaction.php +++ b/src/ConnectionTransaction.php @@ -23,12 +23,12 @@ final class ConnectionTransaction implements Transaction /** * @param Handle $handle - * @param int $isolation * @param callable $release + * @param int $isolation * * @throws \Error If the isolation level is invalid. */ - public function __construct(Handle $handle, int $isolation = SqlTransaction::ISOLATION_COMMITTED, callable $release) + public function __construct(Handle $handle, callable $release, int $isolation = SqlTransaction::ISOLATION_COMMITTED) { switch ($isolation) { case SqlTransaction::ISOLATION_UNCOMMITTED: @@ -62,9 +62,9 @@ public function __destruct() /** * {@inheritdoc} */ - public function lastUsedAt(): int + public function getLastUsedAt(): int { - return $this->handle->lastUsedAt(); + return $this->handle->getLastUsedAt(); } /** diff --git a/src/PgSqlCommandResult.php b/src/PgSqlCommandResult.php index 909c852..5b23c08 100644 --- a/src/PgSqlCommandResult.php +++ b/src/PgSqlCommandResult.php @@ -28,7 +28,7 @@ public function __destruct() /** * @return int Number of rows affected by the INSERT, UPDATE, or DELETE query. */ - public function affectedRows(): int + public function getAffectedRowCount(): int { return \pg_affected_rows($this->handle); } @@ -36,7 +36,7 @@ public function affectedRows(): int /** * @return string */ - public function lastOid(): string + public function getLastOid(): string { return (string) \pg_last_oid($this->handle); } diff --git a/src/PgSqlHandle.php b/src/PgSqlHandle.php index 9ae779d..32e8f5d 100644 --- a/src/PgSqlHandle.php +++ b/src/PgSqlHandle.php @@ -195,7 +195,7 @@ public function isAlive(): bool /** * {@inheritdoc} */ - public function lastUsedAt(): int + public function getLastUsedAt(): int { return $this->lastUsedAt; } diff --git a/src/PgSqlResultSet.php b/src/PgSqlResultSet.php index 594a398..5121c8e 100644 --- a/src/PgSqlResultSet.php +++ b/src/PgSqlResultSet.php @@ -17,9 +17,6 @@ final class PgSqlResultSet implements ResultSet /** @var mixed Last row emitted. */ private $currentRow; - /** @var int Next row fetch type. */ - private $type = self::FETCH_ASSOC; - /** @var int[] */ private $fieldTypes = []; @@ -56,10 +53,9 @@ public function __destruct() /** * {@inheritdoc} */ - public function advance(int $type = self::FETCH_ASSOC): Promise + public function advance(): Promise { $this->currentRow = null; - $this->type = $type; if (++$this->position > \pg_num_rows($this->handle)) { return new Success(false); @@ -71,7 +67,7 @@ public function advance(int $type = self::FETCH_ASSOC): Promise /** * {@inheritdoc} */ - public function getCurrent() + public function getCurrent(int $type = self::FETCH_ASSOC) { if ($this->currentRow !== null) { return $this->currentRow; @@ -98,7 +94,7 @@ public function getCurrent() $result[$column] = $this->cast($column, $result[$column]); } - if ($this->type === self::FETCH_ARRAY) { + if ($type === self::FETCH_ARRAY) { return $this->currentRow = $result; } @@ -107,11 +103,11 @@ public function getCurrent() $assoc[$name] = $result[$index]; } - if ($this->type === self::FETCH_ASSOC) { + if ($type === self::FETCH_ASSOC) { return $this->currentRow = $assoc; } - if ($this->type === self::FETCH_OBJECT) { + if ($type === self::FETCH_OBJECT) { return $this->currentRow = (object) $assoc; } @@ -243,7 +239,7 @@ public function numRows(): int /** * @return int Number of fields in each row. */ - public function numFields(): int + public function getNumFields(): int { return \pg_num_fields($this->handle); } @@ -257,7 +253,7 @@ public function numFields(): int */ public function fieldName(int $fieldNum): string { - if (0 > $fieldNum || $this->numFields() <= $fieldNum) { + if (0 > $fieldNum || $this->getNumFields() <= $fieldNum) { throw new \Error(\sprintf('No field with index %d in result', $fieldNum)); } diff --git a/src/PgSqlStatement.php b/src/PgSqlStatement.php index 3d6790e..b440c6f 100644 --- a/src/PgSqlStatement.php +++ b/src/PgSqlStatement.php @@ -16,9 +16,6 @@ final class PgSqlStatement implements Statement /** @var string */ private $sql; - /** @var Internal\ReferenceQueue */ - private $queue; - /** @var string[] */ private $params; @@ -58,7 +55,7 @@ public function getQuery(): string } /** {@inheritdoc} */ - public function lastUsedAt(): int + public function getLastUsedAt(): int { return $this->lastUsedAt; } diff --git a/src/PooledResultSet.php b/src/PooledResultSet.php index 4c04853..31921ea 100644 --- a/src/PooledResultSet.php +++ b/src/PooledResultSet.php @@ -19,8 +19,8 @@ public function __construct(ResultSet $result, callable $release) $this->result = $result; } - public function numFields(): int + public function getNumFields(): int { - return $this->result->numFields(); + return $this->result->getNumFields(); } } diff --git a/src/PqBufferedResultSet.php b/src/PqBufferedResultSet.php index 968b879..ef5b59b 100644 --- a/src/PqBufferedResultSet.php +++ b/src/PqBufferedResultSet.php @@ -17,9 +17,6 @@ final class PqBufferedResultSet implements ResultSet /** @var mixed Last row emitted. */ private $currentRow; - /** @var int Next row fetch type. */ - private $type = self::FETCH_ASSOC; - /** * @param pq\Result $result PostgreSQL result object. */ @@ -32,10 +29,9 @@ public function __construct(pq\Result $result) /** * {@inheritdoc} */ - public function advance(int $type = self::FETCH_ASSOC): Promise + public function advance(): Promise { $this->currentRow = null; - $this->type = $type; if (++$this->position > $this->result->numRows) { return new Success(false); @@ -47,7 +43,7 @@ public function advance(int $type = self::FETCH_ASSOC): Promise /** * {@inheritdoc} */ - public function getCurrent() + public function getCurrent(int $type = self::FETCH_ASSOC) { if ($this->currentRow !== null) { return $this->currentRow; @@ -57,7 +53,7 @@ public function getCurrent() throw new \Error("No more rows remain in the result set"); } - switch ($this->type) { + switch ($type) { case self::FETCH_ASSOC: return $this->currentRow = $this->result->fetchRow(pq\Result::FETCH_ASSOC); case self::FETCH_ARRAY: @@ -69,12 +65,12 @@ public function getCurrent() } } - public function numRows(): int + public function getNumRows(): int { return $this->result->numRows; } - public function numFields(): int + public function getNumFields(): int { return $this->result->numCols; } diff --git a/src/PqCommandResult.php b/src/PqCommandResult.php index 43af02d..4972321 100644 --- a/src/PqCommandResult.php +++ b/src/PqCommandResult.php @@ -21,7 +21,7 @@ public function __construct(pq\Result $result) /** * @return int Number of rows affected by the INSERT, UPDATE, or DELETE query. */ - public function affectedRows(): int + public function getAffectedRowCount(): int { return $this->result->affectedRows; } diff --git a/src/PqHandle.php b/src/PqHandle.php index 73f4cee..121eaa8 100644 --- a/src/PqHandle.php +++ b/src/PqHandle.php @@ -150,7 +150,7 @@ public function isAlive(): bool /** * {@inheritdoc} */ - public function lastUsedAt(): int + public function getLastUsedAt(): int { return $this->lastUsedAt; } diff --git a/src/PqStatement.php b/src/PqStatement.php index 82c410c..d7fd012 100644 --- a/src/PqStatement.php +++ b/src/PqStatement.php @@ -55,7 +55,7 @@ public function getQuery(): string } /** {@inheritdoc} */ - public function lastUsedAt(): int + public function getLastUsedAt(): int { return $this->lastUsedAt; } diff --git a/src/PqUnbufferedResultSet.php b/src/PqUnbufferedResultSet.php index d6e0fa3..873ce1f 100644 --- a/src/PqUnbufferedResultSet.php +++ b/src/PqUnbufferedResultSet.php @@ -17,9 +17,6 @@ final class PqUnbufferedResultSet implements ResultSet /** @var array|object Last row emitted. */ private $currentRow; - /** @var int Next row fetch type. */ - private $type = self::FETCH_ASSOC; - /** * @param callable(): $fetch Function to fetch next result row. * @param \pq\Result $result PostgreSQL result object. @@ -44,10 +41,9 @@ public function __construct(callable $fetch, pq\Result $result, callable $releas /** * {@inheritdoc} */ - public function advance(int $type = self::FETCH_ASSOC): Promise + public function advance(): Promise { $this->currentRow = null; - $this->type = $type; return $this->producer->advance(); } @@ -55,7 +51,7 @@ public function advance(int $type = self::FETCH_ASSOC): Promise /** * {@inheritdoc} */ - public function getCurrent() + public function getCurrent(int $type = self::FETCH_ASSOC) { if ($this->currentRow !== null) { return $this->currentRow; @@ -64,7 +60,7 @@ public function getCurrent() /** @var \pq\Result $result */ $result = $this->producer->getCurrent(); - switch ($this->type) { + switch ($type) { case self::FETCH_ASSOC: return $this->currentRow = $result->fetchRow(pq\Result::FETCH_ASSOC); case self::FETCH_ARRAY: @@ -79,7 +75,7 @@ public function getCurrent() /** * @return int Number of fields (columns) in each result set. */ - public function numFields(): int + public function getNumFields(): int { return $this->numCols; } diff --git a/src/ResultSet.php b/src/ResultSet.php index a7ac24c..499e9b3 100644 --- a/src/ResultSet.php +++ b/src/ResultSet.php @@ -11,5 +11,5 @@ interface ResultSet extends SqlResultSet * * @return int */ - public function numFields(): int; + public function getNumFields(): int; } diff --git a/test/AbstractLinkTest.php b/test/AbstractLinkTest.php index 6668e5c..02b7712 100644 --- a/test/AbstractLinkTest.php +++ b/test/AbstractLinkTest.php @@ -56,7 +56,7 @@ public function testQueryWithTupleResult() $this->assertInstanceOf(ResultSet::class, $result); - $this->assertSame(2, $result->numFields()); + $this->assertSame(2, $result->getNumFields()); $data = $this->getData(); @@ -144,7 +144,7 @@ public function testPrepare() $this->assertInstanceOf(ResultSet::class, $result); - $this->assertSame(2, $result->numFields()); + $this->assertSame(2, $result->getNumFields()); while (yield $result->advance(SqlResultSet::FETCH_ARRAY)) { $row = $result->getCurrent(); @@ -174,7 +174,7 @@ public function testPrepareWithNamedParams() $this->assertInstanceOf(ResultSet::class, $result); - $this->assertSame(2, $result->numFields()); + $this->assertSame(2, $result->getNumFields()); while (yield $result->advance(SqlResultSet::FETCH_ARRAY)) { $row = $result->getCurrent(); @@ -204,7 +204,7 @@ public function testPrepareWithUnnamedParams() $this->assertInstanceOf(ResultSet::class, $result); - $this->assertSame(2, $result->numFields()); + $this->assertSame(2, $result->getNumFields()); while (yield $result->advance(SqlResultSet::FETCH_ARRAY)) { $row = $result->getCurrent(); @@ -234,7 +234,7 @@ public function testPrepareWithNamedParamsWithDataAppearingAsNamedParam() $this->assertInstanceOf(ResultSet::class, $result); - $this->assertSame(2, $result->numFields()); + $this->assertSame(2, $result->getNumFields()); while (yield $result->advance(SqlResultSet::FETCH_ARRAY)) { $row = $result->getCurrent(); @@ -285,7 +285,7 @@ public function testPrepareSameQuery() $this->assertInstanceOf(ResultSet::class, $result); - $this->assertSame(2, $result->numFields()); + $this->assertSame(2, $result->getNumFields()); while (yield $result->advance()) { $row = $result->getCurrent(); @@ -322,7 +322,7 @@ public function testSimultaneousPrepareSameQuery() $this->assertInstanceOf(ResultSet::class, $result); - $this->assertSame(2, $result->numFields()); + $this->assertSame(2, $result->getNumFields()); while (yield $result->advance()) { $row = $result->getCurrent(); @@ -337,7 +337,7 @@ public function testSimultaneousPrepareSameQuery() $this->assertInstanceOf(ResultSet::class, $result); - $this->assertSame(2, $result->numFields()); + $this->assertSame(2, $result->getNumFields()); while (yield $result->advance()) { $row = $result->getCurrent(); @@ -383,7 +383,7 @@ public function testExecute() $this->assertInstanceOf(ResultSet::class, $result); - $this->assertSame(2, $result->numFields()); + $this->assertSame(2, $result->getNumFields()); while (yield $result->advance()) { $row = $result->getCurrent(); @@ -409,7 +409,7 @@ public function testExecuteWithNamedParams() $this->assertInstanceOf(ResultSet::class, $result); - $this->assertSame(2, $result->numFields()); + $this->assertSame(2, $result->getNumFields()); while (yield $result->advance()) { $row = $result->getCurrent(); From ca6d0016a1b4874ab74d62b5ca35ba390de55e84 Mon Sep 17 00:00:00 2001 From: prolic Date: Sat, 15 Sep 2018 21:43:49 +0800 Subject: [PATCH 3/5] fix abstract link test --- test/AbstractLinkTest.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/test/AbstractLinkTest.php b/test/AbstractLinkTest.php index 02b7712..210eaf9 100644 --- a/test/AbstractLinkTest.php +++ b/test/AbstractLinkTest.php @@ -98,7 +98,7 @@ public function testQueryWithCommandResult() $result = yield $this->connection->query("INSERT INTO test VALUES ('canon', 'jp')"); $this->assertInstanceOf(CommandResult::class, $result); - $this->assertSame(1, $result->affectedRows()); + $this->assertSame(1, $result->getAffectedRowCount()); }); } @@ -146,8 +146,8 @@ public function testPrepare() $this->assertSame(2, $result->getNumFields()); - while (yield $result->advance(SqlResultSet::FETCH_ARRAY)) { - $row = $result->getCurrent(); + while (yield $result->advance()) { + $row = $result->getCurrent(SqlResultSet::FETCH_ARRAY); $this->assertSame($data[0], $row[0]); $this->assertSame($data[1], $row[1]); } @@ -176,8 +176,8 @@ public function testPrepareWithNamedParams() $this->assertSame(2, $result->getNumFields()); - while (yield $result->advance(SqlResultSet::FETCH_ARRAY)) { - $row = $result->getCurrent(); + while (yield $result->advance()) { + $row = $result->getCurrent(SqlResultSet::FETCH_ARRAY); $this->assertSame($data[0], $row[0]); $this->assertSame($data[1], $row[1]); } @@ -206,8 +206,8 @@ public function testPrepareWithUnnamedParams() $this->assertSame(2, $result->getNumFields()); - while (yield $result->advance(SqlResultSet::FETCH_ARRAY)) { - $row = $result->getCurrent(); + while (yield $result->advance()) { + $row = $result->getCurrent(SqlResultSet::FETCH_ARRAY); $this->assertSame($data[0], $row[0]); $this->assertSame($data[1], $row[1]); } @@ -236,8 +236,8 @@ public function testPrepareWithNamedParamsWithDataAppearingAsNamedParam() $this->assertSame(2, $result->getNumFields()); - while (yield $result->advance(SqlResultSet::FETCH_ARRAY)) { - $row = $result->getCurrent(); + while (yield $result->advance()) { + $row = $result->getCurrent(SqlResultSet::FETCH_ARRAY); $this->assertSame($data[0], $row[0]); $this->assertSame($data[1], $row[1]); } @@ -365,8 +365,8 @@ public function testPrepareThenExecuteWithUnconsumedTupleResult() $data = $this->getData(); - for ($i = 0; yield $result->advance(SqlResultSet::FETCH_OBJECT); ++$i) { - $row = $result->getCurrent(); + for ($i = 0; yield $result->advance(); ++$i) { + $row = $result->getCurrent(SqlResultSet::FETCH_OBJECT); $this->assertSame($data[$i][0], $row->domain); $this->assertSame($data[$i][1], $row->tld); } From beb32a9fedd1b39843141b08f00b85018a4765a9 Mon Sep 17 00:00:00 2001 From: prolic Date: Sat, 15 Sep 2018 21:47:42 +0800 Subject: [PATCH 4/5] fix abstract link test --- test/AbstractLinkTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/AbstractLinkTest.php b/test/AbstractLinkTest.php index 210eaf9..1814a7d 100644 --- a/test/AbstractLinkTest.php +++ b/test/AbstractLinkTest.php @@ -83,8 +83,8 @@ public function testQueryWithUnconsumedTupleResult() $data = $this->getData(); - for ($i = 0; yield $result->advance(SqlResultSet::FETCH_OBJECT); ++$i) { - $row = $result->getCurrent(); + for ($i = 0; yield $result->advance(); ++$i) { + $row = $result->getCurrent(SqlResultSet::FETCH_OBJECT); $this->assertSame($data[$i][0], $row->domain); $this->assertSame($data[$i][1], $row->tld); } From 1c606a1487c6490e823675cd860ea129b3bfe3d4 Mon Sep 17 00:00:00 2001 From: prolic Date: Sat, 15 Sep 2018 21:51:24 +0800 Subject: [PATCH 5/5] further changes --- src/PgSqlResultSet.php | 8 ++++---- src/PooledResultSet.php | 4 ++-- src/PqBufferedResultSet.php | 2 +- src/PqUnbufferedResultSet.php | 2 +- src/ResultSet.php | 2 +- test/AbstractLinkTest.php | 20 ++++++++++---------- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/PgSqlResultSet.php b/src/PgSqlResultSet.php index 5121c8e..46944ec 100644 --- a/src/PgSqlResultSet.php +++ b/src/PgSqlResultSet.php @@ -239,7 +239,7 @@ public function numRows(): int /** * @return int Number of fields in each row. */ - public function getNumFields(): int + public function getFieldCount(): int { return \pg_num_fields($this->handle); } @@ -251,9 +251,9 @@ public function getNumFields(): int * * @throws \Error If the field number does not exist in the result. */ - public function fieldName(int $fieldNum): string + public function getFieldName(int $fieldNum): string { - if (0 > $fieldNum || $this->getNumFields() <= $fieldNum) { + if (0 > $fieldNum || $this->getFieldCount() <= $fieldNum) { throw new \Error(\sprintf('No field with index %d in result', $fieldNum)); } @@ -267,7 +267,7 @@ public function fieldName(int $fieldNum): string * * @throws \Error If the field name does not exist in the result. */ - public function fieldNum(string $fieldName): int + public function getFieldIndex(string $fieldName): int { $result = \pg_field_num($this->handle, $fieldName); diff --git a/src/PooledResultSet.php b/src/PooledResultSet.php index 31921ea..fcf88f3 100644 --- a/src/PooledResultSet.php +++ b/src/PooledResultSet.php @@ -19,8 +19,8 @@ public function __construct(ResultSet $result, callable $release) $this->result = $result; } - public function getNumFields(): int + public function getFieldCount(): int { - return $this->result->getNumFields(); + return $this->result->getFieldCount(); } } diff --git a/src/PqBufferedResultSet.php b/src/PqBufferedResultSet.php index ef5b59b..e0dc232 100644 --- a/src/PqBufferedResultSet.php +++ b/src/PqBufferedResultSet.php @@ -70,7 +70,7 @@ public function getNumRows(): int return $this->result->numRows; } - public function getNumFields(): int + public function getFieldCount(): int { return $this->result->numCols; } diff --git a/src/PqUnbufferedResultSet.php b/src/PqUnbufferedResultSet.php index 873ce1f..0f1c9cc 100644 --- a/src/PqUnbufferedResultSet.php +++ b/src/PqUnbufferedResultSet.php @@ -75,7 +75,7 @@ public function getCurrent(int $type = self::FETCH_ASSOC) /** * @return int Number of fields (columns) in each result set. */ - public function getNumFields(): int + public function getFieldCount(): int { return $this->numCols; } diff --git a/src/ResultSet.php b/src/ResultSet.php index 499e9b3..3fc03c5 100644 --- a/src/ResultSet.php +++ b/src/ResultSet.php @@ -11,5 +11,5 @@ interface ResultSet extends SqlResultSet * * @return int */ - public function getNumFields(): int; + public function getFieldCount(): int; } diff --git a/test/AbstractLinkTest.php b/test/AbstractLinkTest.php index 1814a7d..2939091 100644 --- a/test/AbstractLinkTest.php +++ b/test/AbstractLinkTest.php @@ -56,7 +56,7 @@ public function testQueryWithTupleResult() $this->assertInstanceOf(ResultSet::class, $result); - $this->assertSame(2, $result->getNumFields()); + $this->assertSame(2, $result->getFieldCount()); $data = $this->getData(); @@ -144,7 +144,7 @@ public function testPrepare() $this->assertInstanceOf(ResultSet::class, $result); - $this->assertSame(2, $result->getNumFields()); + $this->assertSame(2, $result->getFieldCount()); while (yield $result->advance()) { $row = $result->getCurrent(SqlResultSet::FETCH_ARRAY); @@ -174,7 +174,7 @@ public function testPrepareWithNamedParams() $this->assertInstanceOf(ResultSet::class, $result); - $this->assertSame(2, $result->getNumFields()); + $this->assertSame(2, $result->getFieldCount()); while (yield $result->advance()) { $row = $result->getCurrent(SqlResultSet::FETCH_ARRAY); @@ -204,7 +204,7 @@ public function testPrepareWithUnnamedParams() $this->assertInstanceOf(ResultSet::class, $result); - $this->assertSame(2, $result->getNumFields()); + $this->assertSame(2, $result->getFieldCount()); while (yield $result->advance()) { $row = $result->getCurrent(SqlResultSet::FETCH_ARRAY); @@ -234,7 +234,7 @@ public function testPrepareWithNamedParamsWithDataAppearingAsNamedParam() $this->assertInstanceOf(ResultSet::class, $result); - $this->assertSame(2, $result->getNumFields()); + $this->assertSame(2, $result->getFieldCount()); while (yield $result->advance()) { $row = $result->getCurrent(SqlResultSet::FETCH_ARRAY); @@ -285,7 +285,7 @@ public function testPrepareSameQuery() $this->assertInstanceOf(ResultSet::class, $result); - $this->assertSame(2, $result->getNumFields()); + $this->assertSame(2, $result->getFieldCount()); while (yield $result->advance()) { $row = $result->getCurrent(); @@ -322,7 +322,7 @@ public function testSimultaneousPrepareSameQuery() $this->assertInstanceOf(ResultSet::class, $result); - $this->assertSame(2, $result->getNumFields()); + $this->assertSame(2, $result->getFieldCount()); while (yield $result->advance()) { $row = $result->getCurrent(); @@ -337,7 +337,7 @@ public function testSimultaneousPrepareSameQuery() $this->assertInstanceOf(ResultSet::class, $result); - $this->assertSame(2, $result->getNumFields()); + $this->assertSame(2, $result->getFieldCount()); while (yield $result->advance()) { $row = $result->getCurrent(); @@ -383,7 +383,7 @@ public function testExecute() $this->assertInstanceOf(ResultSet::class, $result); - $this->assertSame(2, $result->getNumFields()); + $this->assertSame(2, $result->getFieldCount()); while (yield $result->advance()) { $row = $result->getCurrent(); @@ -409,7 +409,7 @@ public function testExecuteWithNamedParams() $this->assertInstanceOf(ResultSet::class, $result); - $this->assertSame(2, $result->getNumFields()); + $this->assertSame(2, $result->getFieldCount()); while (yield $result->advance()) { $row = $result->getCurrent();