packages/sql-semantics-postgres/src/Statement/Manipulation/Cursor/Holdability.php
1<?php
2
3declare(strict_types=1);
4
5namespace SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Cursor;
6
7/**
8 * Whether a cursor outlives the transaction that created it: WITH HOLD or WITHOUT HOLD.
9 *
10 * Mirrors the `CURSOR_OPT_HOLD` bit of PostgreSQL's `DeclareCursorStmt`;
11 * WITHOUT HOLD is also what a cursor without either clause is. The value is
12 * the first keyword.
13 * Source: https://www.postgresql.org/docs/17/sql-declare.html.
14 *
15 * @visibility public
16 * @example Reading the holdability of a cursor
17 * $declare = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('DECLARE c CURSOR WITH HOLD FOR SELECT 1');
18 * $declare->statement->hold // => \SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Cursor\Holdability::With
19 */
20enum Holdability: string
21{
22 case With = 'WITH';
23 case Without = 'WITHOUT';
24}
25