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.
sqlite3 :: Statement :: close_with_iterator
Should anyiterator
close this statement on Iterator::finish
?
sqlite3 :: Statement :: close_with_iterator=
Should anyiterator
close this statement on Iterator::finish
?
sqlite3 :: Statement :: defaultinit
sqlite3 :: Statement :: iterator
Reset this statement and return aStatementIterator
to iterate over the result
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
sqlite3 :: Statement :: close_with_iterator
Should anyiterator
close this statement on Iterator::finish
?
sqlite3 :: Statement :: close_with_iterator=
Should anyiterator
close this statement on Iterator::finish
?
core :: Object :: defaultinit
sqlite3 :: Statement :: defaultinit
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
sqlite3 :: Statement :: iterator
Reset this statement and return aStatementIterator
to iterate over the result
core :: Object :: output_class_name
Display class name on stdout (debug only).
# 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