|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object SQLite.Stmt
Class to represent compiled SQLite3 statement. Note, that all native methods of this class are not synchronized, i.e. it is up to the caller to ensure that only one thread is in these methods at any one time.
Field Summary | |
protected int |
error_code
Internal last error code for prepare()/step() methods. |
private long |
handle
Internal handle for the SQLite3 statement. |
Constructor Summary | |
Stmt()
|
Method Summary | |
int |
bind_parameter_count()
Return number of parameters in compiled SQLite3 statement. |
int |
bind_parameter_index(String name)
Return index of named parameter in compiled SQLite3 statement. |
String |
bind_parameter_name(int pos)
Return name of parameter in compiled SQLite3 statement. |
void |
bind_zeroblob(int pos,
int length)
Bind positional zero'ed blob to compiled SQLite3 statement. |
void |
bind(int pos)
Bind positional SQL null to compiled SQLite3 statement. |
void |
bind(int pos,
byte[] value)
Bind positional byte array to compiled SQLite3 statement. |
void |
bind(int pos,
double value)
Bind positional double value to compiled SQLite3 statement. |
void |
bind(int pos,
int value)
Bind positional integer value to compiled SQLite3 statement. |
void |
bind(int pos,
long value)
Bind positional long value to compiled SQLite3 statement. |
void |
bind(int pos,
String value)
Bind positional String to compiled SQLite3 statement. |
void |
clear_bindings()
Clear all bound parameters of the compiled SQLite3 statement. |
void |
close()
Close the compiled SQLite3 statement. |
byte[] |
column_bytes(int col)
Retrieve blob column from exec'ed SQLite3 statement. |
int |
column_count()
Retrieve number of columns of exec'ed SQLite3 statement. |
String |
column_database_name(int col)
Return database name of column of SQLite3 statement. |
String |
column_decltype(int col)
Return declared column type of SQLite3 statement. |
double |
column_double(int col)
Retrieve double column from exec'ed SQLite3 statement. |
int |
column_int(int col)
Retrieve integer column from exec'ed SQLite3 statement. |
long |
column_long(int col)
Retrieve long column from exec'ed SQLite3 statement. |
String |
column_name(int col)
Return column name of column of SQLite3 statement. |
String |
column_origin_name(int col)
Return origin column name of column of SQLite3 statement. |
String |
column_string(int col)
Retrieve string column from exec'ed SQLite3 statement. |
String |
column_table_name(int col)
Return table name of column of SQLite3 statement. |
int |
column_type(int col)
Retrieve column type from exec'ed SQLite3 statement. |
Object |
column(int col)
Retrieve column data as object from exec'ed SQLite3 statement. |
protected void |
finalize()
Destructor for object. |
private static void |
internal_init()
Internal native initializer. |
boolean |
prepare()
Prepare the next SQL statement for the Stmt instance. |
void |
reset()
Reset the compiled SQLite3 statement without clearing parameter bindings. |
int |
status(int op,
boolean flg)
Return statement status information. |
boolean |
step()
Perform one step of compiled SQLite3 statement. |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected int error_code
private long handle
Constructor Detail |
public Stmt()
Method Detail |
public int bind_parameter_count() throws Exception
Exception
- indicating SQLite errorpublic int bind_parameter_index(String name) throws Exception
name
- of parameter
Exception
- indicating SQLite errorpublic String bind_parameter_name(int pos) throws Exception
pos
- parameter index, 1-based
Exception
- indicating SQLite errorpublic void bind_zeroblob(int pos, int length) throws Exception
pos
- parameter index, 1-basedlength
- byte size of zero blob
Exception
- indicating SQLite errorpublic void bind(int pos) throws Exception
pos
- parameter index, 1-based
Exception
- indicating SQLite errorpublic void bind(int pos, byte[] value) throws Exception
pos
- parameter index, 1-basedvalue
- value of parameter, may be null
Exception
- indicating SQLite errorpublic void bind(int pos, double value) throws Exception
pos
- parameter index, 1-basedvalue
- value of parameter
Exception
- indicating SQLite errorpublic void bind(int pos, int value) throws Exception
pos
- parameter index, 1-basedvalue
- value of parameter
Exception
- indicating SQLite errorpublic void bind(int pos, long value) throws Exception
pos
- parameter index, 1-basedvalue
- value of parameter
Exception
- indicating SQLite errorpublic void bind(int pos, String value) throws Exception
pos
- parameter index, 1-basedvalue
- value of parameter, may be null
Exception
- indicating SQLite errorpublic void clear_bindings() throws Exception
Exception
- indicating SQLite errorpublic void close() throws Exception
Exception
- indicating SQLite errorpublic byte[] column_bytes(int col) throws Exception
col
- column number, 0-based
Exception
- indicating SQLite errorpublic int column_count() throws Exception
Exception
- indicating SQLite errorpublic String column_database_name(int col) throws Exception
col
- column number, 0-based
Exception
- indicating SQLite errorpublic String column_decltype(int col) throws Exception
col
- column number, 0-based
Exception
- indicating SQLite errorpublic double column_double(int col) throws Exception
col
- column number, 0-based
Exception
- indicating SQLite errorpublic int column_int(int col) throws Exception
col
- column number, 0-based
Exception
- indicating SQLite errorpublic long column_long(int col) throws Exception
col
- column number, 0-based
Exception
- indicating SQLite errorpublic String column_name(int col) throws Exception
col
- column number, 0-based
Exception
- indicating SQLite errorpublic String column_origin_name(int col) throws Exception
col
- column number, 0-based
Exception
- indicating SQLite errorpublic String column_string(int col) throws Exception
col
- column number, 0-based
Exception
- indicating SQLite errorpublic String column_table_name(int col) throws Exception
col
- column number, 0-based
Exception
- indicating SQLite errorpublic int column_type(int col) throws Exception
col
- column number, 0-based
Exception
- indicating SQLite errorpublic Object column(int col) throws Exception
col
- column number, 0-based
Exception
- indicating SQLite errorprotected void finalize()
private static void internal_init()
public boolean prepare() throws Exception
Exception
- indicating SQLite errorpublic void reset() throws Exception
Exception
- indicating SQLite errorpublic int status(int op, boolean flg)
op
- which counter to reportflg
- reset flag
public boolean step() throws Exception
... try { Stmt s = db.prepare("select * from x; select * from y;"); s.bind(...); ... s.bind(...); while (s.step(cb)) { Object o = s.value(...); ... } // s.reset() for re-execution or // s.prepare() for the next piece of SQL while (s.prepare()) { s.bind(...); ... s.bind(...); while (s.step(cb)) { Object o = s.value(...); ... } } } catch (SQLite.Exception e) { s.close(); }
Exception
- indicating SQLite error
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |