Skip to content
Snippets Groups Projects
Commit f7746ea2 authored by Jan Kuchař's avatar Jan Kuchař
Browse files

PostgreCursorFactory: now knows how to create semantic cursors

parent 1ff105c6
Branches master
No related tags found
No related merge requests found
Pipeline #
......@@ -8,6 +8,10 @@ namespace Grifart\Mappi\Cursor\Driver;
use Dibi\Connection;
use Grifart\Mappi\Cursor\Cursor;
use Grifart\Mappi\Cursor\ICursor;
use Grifart\Mappi\Cursor\Position;
use Grifart\Mappi\Cursor\SemanticCursor;
use Grifart\Mappi\Cursor\SemanticTrackedCursor;
use Grifart\Mappi\Cursor\TrackedCursor;
final class PostgresCursorFactory
{
......@@ -48,6 +52,20 @@ final class PostgresCursorFactory
);
}
public function createSemantic(string $sql, bool $scroll) : SemanticTrackedCursor
{
$cursor = $this->create($sql, $scroll);
return new SemanticCursor($cursor);
}
public function createTrackedSemantic(string $sql, bool $scroll) : SemanticTrackedCursor
{
$cursor = $this->create($sql, $scroll);
return new SemanticTrackedCursor(
new TrackedCursor($cursor, Position::fromLeft(0))
);
}
/**
* Generate cursor unique name in current transaction
* @return string
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment