class sql::Statement

sys::Obj
  sql::Statement

Source

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.

close

Void close()

Source

Close the statement.

execute

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

Source

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
limit

Int? limit

Source

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()

Source

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

query

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

Source

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)

Source

Execute the statement. For each row in the result, invoke the specified function each. The Obj passed to the each function will be of type Row.

sql

const Str sql

Source

The SQL text used to create this statement.