class

Statement

class Statement : Obj

Statement is an executable statement for a specific database. A statement may be executed immediately or prepared and executed later with parameters. See pod-doc.

fields generateKeys

Whether an insert requests auto-generated keys from the driver

limit

Maximum number of rows returned when this statement is executed

sql

The SQL text used to create this statement

methods close

Close the statement

execute

Execute a SQL statement and if applicable return a result

executeBatch

Execute a batch of commands on a prepared Statement

prepare

Prepare this statement by compiling for efficient execution

query

Execute the statement and return the resulting List of Rows

queryEach

Execute the statement

queryEachWhile

Execute the statement

close Void close()

Close the statement.

execute Obj execute([Str:Obj]? params := null)

Execute a SQL statement and if applicable return a result:

  • If the statement is a query or procedure which produces a result set, then return Row[]
  • If the statement is an insert and auto-generated keys are supported by the connector then return Int[] or Str[] of keys generated
  • Return an Int with the update count

executeBatch BatchResult executeBatch([Str:Obj]?[] paramsList)

Execute a batch of commands on a prepared Statement. If all commands execute successfully, return a BatchResult containing an array of update counts, and an array of auto-generated keys.

For each element in the update counts array, if the element is non-null, then it represents an update count giving the number of rows in the database that were affected by the command's execution. If a given array element is null, it indicates that the command was processed successfully but that the number of rows affected is unknown.

The keys array contains the auto-generated keys, if any, for each command. An element is null if the driver did not return a key for that command. Note that some drivers return the keys even if they were not auto-generated.

If the driver returns auto-generated keys for some but not all of the commands, throw SqlErr since the keys cannot be correlated to their commands.

If one of the commands in a batch update fails to execute properly, this method throws a SqlErr that wraps a java.sql.BatchUpdateException, and a JDBC driver may or may not continue to process the remaining commands in the batch, consistent with the underlying DBMS -- either always continuing to process commands or never continuing to process commands.

generateKeys Bool : generateKeys

Whether an insert requests auto-generated keys from the driver. Turning this off skips the cost of returning keys, and inserts return update counts instead. Must be set before prepare, otherwise throw SqlErr. Defaults to true.

limit Int? : limit

Maximum number of rows returned when this statement is executed. If limit is exceeded rows are silently dropped. A value of null indicates no limit.

prepare This prepare()

Prepare this statement by compiling for efficient execution. Return this.

query Row[] query([Str:Obj]? params := null)

Execute the statement and return the resulting List of Rows. The Cols are available from List.of.fields or on type.fields of each row instance.

queryEach Void queryEach([Str:Obj]? params, |Row| eachFunc)

Execute the statement. For each row in the result, invoke the specified function eachFunc.

queryEachWhile Obj? queryEachWhile([Str:Obj]? params, |Row->Obj?| eachFunc)

Execute the statement. For each row in the result, invoke the specified function eachFunc. If the function returns non-null, then break the iteration and return the resulting object. Return null if the function returns null for every item.

sql const Str : sql

The SQL text used to create this statement.

Haxall 4.0.7 ∙ 27-Oct-2026 09:10 EDT