Statement is an executable statement for a specific database. A statement may be executed immediately or prepared and executed later with parameters.
See docLib::Sql.
Slots
- closeSource
-
native Void close()
Close the statement.
-
internal readonly Connection conn
The connection that this statement uses.
- executeSource
-
native Int execute([Str:Obj]? params := null)
Execute a SQL statement and if applicable return the number of rows modified.
-
new make(Connection conn, Str sql)
Make a new statement with the specified SQL text.
- prepareSource
-
native This prepare()
Prepare this statement by compiling for efficient execution. Return this.
- querySource
-
native Row[] query([Str:Obj]? params := null)
Execute the statement and return the resulting
List
ofRows
. TheCols
are available fromList.of.fields
or ontype.fields
of each row instance. - queryEachSource
-
native Void queryEach([Str:Obj]? params, |Row| eachFunc)
Execute the statement. For each row in the result, invoke the specified function
each
. TheObj
passed to theeach
function will be of typeRow
. - sqlSource
-
readonly Str sql
The SQL text used to create this statement.