logo

class

sql::Statement

sys::Obj
  sql::Statement

Statement manages a statement prepared for a database connection.

Refer to the Sql docs for more details.

Slots

close

Void close()

Close the statement.

conn

readonly Connection conn

The connection that this statement uses.

execute

Int execute(Str:Obj params)

Execute a SQL statement and if applicable return the number of rows modified.

query

Obj[] query(Str:Obj params, Type of := def)

Execute the statement and get a relational table as the result. If of is null, the result is returned as a List of Rows. The Cols are available from List.of.fields or on type.fields of each row instance. If of is specified, then the result is returned as a List of that type. Columns are mapped to the type's fields. If a column cannot be mapped to a field, then an SqlErr is thrown.

queryEach

Void queryEach(Str:Obj params, Type of, |Obj| eachFunc)

sql

readonly Str sql

The SQL text used to create this statement.