Class StatementCount

java.lang.Object
dev.frostlake.executor.StatementCount

public final class StatementCount extends Object
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 Type
    Method
    Description
    static Integer
    The value an exact ALTER SESSION SET MULTI_STATEMENT_COUNT = n statement assigns, 1 for the UNSET form (the parameter's default), or null when sql is not that statement — so a connection can follow the session parameter without a server round trip.
    static int
    Top-level statement count of sql under the scanner rules above.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • countStatements

      public static int countStatements(String sql)
      Top-level statement count of sql under the scanner rules above. Scripting regions count as ONE statement, the way the account counts them (live-verified: an unquoted CREATE PROCEDURE … AS BEGIN …; END; and a bare anonymous BEGIN …; END; both pass under the default single-statement gate): a block-opening BEGIN (one not immediately followed by ;, TRANSACTION, WORK or NAME — those are transaction starts) or a top-level DECLARE opens a region; nested blocks pair their own BEGIN/END; END IF/WHILE/FOR/LOOP/REPEAT close constructs the counter never opened and are skipped; a CASE inside a region pairs with its bare END or END CASE.
    • assignedCount

      public static Integer assignedCount(String sql)
      The value an exact ALTER SESSION SET MULTI_STATEMENT_COUNT = n statement assigns, 1 for the UNSET form (the parameter's default), or null when sql is not that statement — so a connection can follow the session parameter without a server round trip.