return 0 for non iterable results

If there are no columns, it's not a iterable result set and we can return 0. This fixes issues with things like CREATE statement.
This commit is contained in:
Thomas Portelange 2018-03-12 14:04:43 +01:00 committed by GitHub
parent b36f3598bb
commit 978c371820
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,6 +58,11 @@ class SQLite3Query extends Query
*/ */
public function numRecords() public function numRecords()
{ {
// Some queries are not iterable using fetchArray like CREATE statement
if (!$this->handle->numColumns()) {
return 0;
}
$this->handle->reset(); $this->handle->reset();
$c=0; $c=0;
while ($this->handle->fetchArray()) { while ($this->handle->fetchArray()) {