Package dev.frostlake.executor
Class StatementCount
java.lang.Object
dev.frostlake.executor.StatementCount
How many top-level statements a request holds, counted the way the account counts them
(live-verified). One rule decides the multi-statement gate for every client: the HTTP endpoint
applies it to a request, and the JDBC driver applies it before sending one.
Counting is scanner-based: string literals (both '' and \' escapes), quoted
identifiers, --/// and /* */ comments and $$…$$ bodies are
opaque; a trailing ; adds nothing, and neither does an empty statement; a scripting region —
an unquoted block or a DECLARE-headed body — counts as one statement.
-
Method Summary
Modifier and TypeMethodDescriptionstatic IntegerassignedCount(String sql) The value an exactALTER SESSION SET MULTI_STATEMENT_COUNT = nstatement assigns, 1 for theUNSETform (the parameter's default), or null whensqlis not that statement — so a connection can follow the session parameter without a server round trip.static intcountStatements(String sql) Top-level statement count ofsqlunder the scanner rules above.
-
Method Details
-
countStatements
Top-level statement count ofsqlunder the scanner rules above. Scripting regions count as ONE statement, the way the account counts them (live-verified: an unquotedCREATE PROCEDURE … AS BEGIN …; END;and a bare anonymousBEGIN …; END;both pass under the default single-statement gate): a block-openingBEGIN(one not immediately followed by;,TRANSACTION,WORKorNAME— those are transaction starts) or a top-levelDECLAREopens a region; nested blocks pair their own BEGIN/END;END IF/WHILE/FOR/LOOP/REPEATclose constructs the counter never opened and are skipped; a CASE inside a region pairs with its bareENDorEND CASE. -
assignedCount
The value an exactALTER SESSION SET MULTI_STATEMENT_COUNT = nstatement assigns, 1 for theUNSETform (the parameter's default), or null whensqlis not that statement — so a connection can follow the session parameter without a server round trip.
-