sqlite3 :: Statement :: defaultinit
# Prepared Sqlite3 statement
#
# Instances of this class are created from `Sqlite3DB::prepare` and
# its shortcuts: `create_table`, `insert`, `replace` and `select`.
# The results should be explored with an `iterator`,
# and each call to `iterator` resets the request.
# If `close_with_iterator` the iterator calls `close`
# on this request upon finishing.
class Statement
private var native_statement: NativeStatement
# Is this statement usable?
var is_open = true
# Should any `iterator` close this statement on `Iterator::finish`?
#
# If `true`, the default, any `StatementIterator` created by calls to
# `iterator` invokes `close` on this request when finished iterating.
# Otherwise, `close` must be called manually.
var close_with_iterator = true is writable
# Close and finalize this statement
fun close
do
if not is_open then return
is_open = false
native_statement.finalize
end
# Reset this statement and return a `StatementIterator` to iterate over the result
fun iterator: StatementIterator
do
native_statement.reset
return new StatementIterator(self)
end
end
lib/sqlite3/sqlite3.nit:115,1--151,3