Skip to content

Commit

Permalink
Merge pull request #11 from chocofamilyme/aidyn.lazy_collection_support
Browse files Browse the repository at this point in the history
Поддержка метода cursor
  • Loading branch information
AidynMakhataev authored Jan 28, 2020
2 parents b78f050 + b1d0724 commit f03982a
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/Tarantool/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

use Illuminate\Database\Connection as BaseConnection;
use Illuminate\Database\Schema\Builder as SchemaBuilder;
use Tarantool\Client\SqlQueryResult;

class Connection extends BaseConnection
{
Expand Down Expand Up @@ -68,7 +69,22 @@ public function table($table, $as = null)
{
return $this->query()->from($table);
}


/**
* @param string $query
* @param array $bindings
* @param bool $useReadPdo
* @return \Generator
* @throws \Exception
*/
public function cursor($query, $bindings = [], $useReadPdo = true)
{
/** @var SqlQueryResult $result */
$result = $this->run($query, $bindings, function () {});

return $result->getIterator();
}

/**
* Get a new query builder instance.
*
Expand Down

0 comments on commit f03982a

Please sign in to comment.