klyn.code.sql.SqlScriptSplitter.splitValidated
method
public static splitValidated(
script as String,
maxScriptSize as Long = 2000000,
maxStatements as Long = 100
) as ArrayList<String> throws ValueException
Description

Validates and splits a multi-statement SQL script, raising ValueException when the script is empty, exceeds maxScriptSize or maxStatements, has an invalid DELIMITER directive, or contains an unterminated literal or block comment.

Parameters
ParameterDescription
scriptComplete SQL script text.
maxScriptSizeMaximum allowed script character length.
maxStatementsMaximum allowed executable statements.
Returns

Non-empty ordered list of executable SQL statement strings.

Throws
  • ValueException If validation fails.
Example
import klyn.code.sql

stmts = SqlScriptSplitter.splitValidated("SELECT 1; SELECT 2;")
assert stmts.size == 2