|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectSQLite.Database
Main class wrapping an SQLite database.
Field Summary | |
protected int |
error_code
Internal last error code for exec() methods. |
protected long |
handle
Internal handle for the native SQLite API. |
Constructor Summary | |
Database()
|
Method Summary | |
void |
busy_handler(BusyHandler bh)
Establish a busy callback method which gets called when an SQLite table is locked. |
void |
busy_timeout(int ms)
Set the timeout for waiting for an SQLite table to become unlocked. |
long |
changes()
Return the number of changed rows for the last statement. |
void |
close()
Close the underlying SQLite database file. |
Vm |
compile(java.lang.String sql)
Compile and return SQLite VM for SQL statement. |
Vm |
compile(java.lang.String sql,
java.lang.String[] args)
Compile and return SQLite VM for SQL statement. |
static boolean |
complete(java.lang.String sql)
See if an SQL statement is complete. |
void |
create_aggregate(java.lang.String name,
int nargs,
Function f)
Create aggregate function. |
void |
create_function(java.lang.String name,
int nargs,
Function f)
Create regular function. |
java.lang.String |
dbversion()
Return SQLite version number as string. |
static java.lang.String |
error_string(int error_code)
Return error string given SQLite error code. |
void |
exec(java.lang.String sql,
Callback cb)
Execute an SQL statement and invoke callback methods for each row of the result set. |
void |
exec(java.lang.String sql,
Callback cb,
java.lang.String[] args)
Execute an SQL statement and invoke callback methods for each row of the result set. |
protected void |
finalize()
Destructor for object. |
void |
function_type(java.lang.String name,
int type)
Set function return type. |
TableResult |
get_table(java.lang.String sql)
Convenience method to retrieve an entire result set into memory. |
TableResult |
get_table(java.lang.String sql,
java.lang.String[] args)
Convenience method to retrieve an entire result set into memory. |
void |
get_table(java.lang.String sql,
java.lang.String[] args,
TableResult tbl)
Convenience method to retrieve an entire result set into memory. |
private static void |
internal_init()
Internal native initializer. |
void |
interrupt()
Abort the current SQLite operation. |
boolean |
is3()
Check type of open database. |
int |
last_error()
Return the code of the last error occured in any of the exec() methods. |
long |
last_insert_rowid()
Return the row identifier of the last inserted row. |
void |
open_aux_file(java.lang.String filename)
Open SQLite auxiliary database file for temporary tables. |
void |
open(java.lang.String filename,
int mode)
Open an SQLite database file. |
void |
progress_handler(int n,
ProgressHandler p)
Establish a progress callback method which gets called after N SQLite VM opcodes. |
void |
set_authorizer(Authorizer auth)
Set authorizer function. |
void |
set_encoding(java.lang.String enc)
Set character encoding. |
void |
trace(Trace tr)
Set trace function. |
static java.lang.String |
version()
Return SQLite version number as string. |
void |
vm_compile_args(java.lang.String sql,
Vm vm,
java.lang.String[] args)
Internal compile method, SQLite 3.0 only. |
void |
vm_compile(java.lang.String sql,
Vm vm)
Internal compile method. |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected int error_code
protected long handle
Constructor Detail |
public Database()
Method Detail |
public void busy_handler(BusyHandler bh)
bh
- the object implementing the busy callback methodpublic void busy_timeout(int ms)
ms
- number of millisecond to waitpublic long changes()
public void close() throws Exception
Exception
public Vm compile(java.lang.String sql) throws Exception
sql
- SQL statement to be compiled
Exception
public Vm compile(java.lang.String sql, java.lang.String[] args) throws Exception
sql
- SQL statement to be compiledargs
- arguments for the SQL statement, '%q' substitution
Exception
public static boolean complete(java.lang.String sql)
sql
- the SQL statement to be checkedpublic void create_aggregate(java.lang.String name, int nargs, Function f)
name
- the name of the new functionnargs
- number of arguments to functionf
- interface of functionpublic void create_function(java.lang.String name, int nargs, Function f)
name
- the name of the new functionnargs
- number of arguments to functionf
- interface of functionpublic java.lang.String dbversion()
public static java.lang.String error_string(int error_code)
error_code
- the error code
public void exec(java.lang.String sql, Callback cb) throws Exception
It the method fails, an SQLite.Exception is thrown and an error code is set, which later can be retrieved by the last_error() method.
sql
- the SQL statement to be executedcb
- the object implementing the callback methods
Exception
public void exec(java.lang.String sql, Callback cb, java.lang.String[] args) throws Exception
String args[] = new String[1]; args[0] = "tab%"; db.exec("select * from sqlite_master where type like '%q'", null, args);It the method fails, an SQLite.Exception is thrown and an error code is set, which later can be retrieved by the last_error() method.
sql
- the SQL statement to be executedcb
- the object implementing the callback methodsargs
- arguments for the SQL statement, '%q' substitution
Exception
protected void finalize()
public void function_type(java.lang.String name, int type)
name
- the name of the function whose return type is to be settype
- return type code, e.g. SQLite.Constants.SQLITE_NUMERICpublic TableResult get_table(java.lang.String sql) throws Exception
sql
- the SQL statement to be executed
Exception
public TableResult get_table(java.lang.String sql, java.lang.String[] args) throws Exception
sql
- the SQL statement to be executedargs
- arguments for the SQL statement, '%q' substitution
Exception
public void get_table(java.lang.String sql, java.lang.String[] args, TableResult tbl) throws Exception
sql
- the SQL statement to be executedargs
- arguments for the SQL statement, '%q' substitutiontbl
- TableResult to receive result set
Exception
private static void internal_init()
public void interrupt()
public boolean is3()
public int last_error()
public long last_insert_rowid()
public void open_aux_file(java.lang.String filename) throws Exception
filename
- the name of the auxiliary file or null
Exception
public void open(java.lang.String filename, int mode) throws Exception
filename
- the name of the database filemode
- open mode, currently ignored
Exception
public void progress_handler(int n, ProgressHandler p)
n
- number of SQLite VM opcodes until callback is invokedp
- the object implementing the progress callback methodpublic void set_authorizer(Authorizer auth)
auth
- the authorizer functionpublic void set_encoding(java.lang.String enc) throws Exception
enc
- name of encoding
Exception
public void trace(Trace tr)
tr
- the trace functionpublic static java.lang.String version()
public void vm_compile_args(java.lang.String sql, Vm vm, java.lang.String[] args) throws Exception
sql
- SQL statementargs
- arguments for the SQL statement, '%q' substitutionvm
- Vm object
Exception
public void vm_compile(java.lang.String sql, Vm vm) throws Exception
sql
- SQL statementvm
- Vm object
Exception
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |