|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.sqlite.Database
public class Database
sqlite3 wrapper class.
Field Summary | |
---|---|
protected java.util.Map<java.lang.String,java.lang.String> |
info
database properties |
Constructor Summary | |
---|---|
Database(java.lang.String filename,
java.util.Map<java.lang.String,java.lang.String> info)
open database. |
Method Summary | |
---|---|
void |
beginTransaction(TransactionType type)
begin transaction. |
int |
changes()
invoke sqlite3_changes() function. |
void |
clearAuthorizer()
invoke org.sqlite.auth.Authorizer#unregister() function. |
void |
clearBusyHandler()
invoke org.sqlite.event.BusyHandler#unregister() function. |
void |
clearCollationNeededHandler()
invoke org.sqlite.event.CollationNeededHandler#unregister(() method. |
void |
clearCommitHook()
invoke org.sqlite.event.CommitHook#clear() method. |
void |
clearProfiler()
invoke org.sqlite.profiler.Profiler#clear() method. |
void |
clearProgressHandler()
invoke org.sqlite.event.ProgressHandler#unregister() method. |
void |
clearRollbackHook()
invoke org.sqlite.event.RollbackHook#clear() function. |
void |
clearTracer()
invoke org.sqlite.profiler.Tracer#clear() method. |
void |
clearUpdateHook()
invoke org.sqlite.event.UpdateHook#clear() method. |
void |
close()
invoke sqlite3_close() function. |
void |
commitTransaction()
commit toransaction. |
int[] |
connectionStatus(int op,
boolean reset)
invoke sqlite3_db_status() function. |
void |
createCollationSequence(Collator col)
invoke org.sqlite.text.Collator#register() method. |
void |
createFunction(Function func)
invoke org.sqlite.udf.Function#register() method. |
void |
disableExtendedResultCodes()
invoke sqlite3_extended_result_codes(off) function. |
void |
disableLoadExtention()
invoke sqlite3_enable_load_extension(off) function. |
static void |
disableSharedCache()
invoke sqlite3_enable_shared_cache(off) function. |
void |
dropCollationSequence(Collator col)
invoke org.sqlite.text.Collator#unregister() method. |
void |
dropFunction(Function func)
invoke org.sqlite.udf.Function#unregister() method. |
void |
enableExtendedResultCodes()
invoke sqlite3_extended_result_codes(on) function. |
void |
enableLoadExtention()
invoke sqlite3_enable_load_extension(on) function. |
static void |
enableSharedCache()
invoke sqlite3_enable_shared_cache(on) function. |
void |
execute(java.lang.String sql)
invoke sqlite3_exec() function. |
void |
execute(java.lang.String sql,
ExecCallback callback,
SWIGTYPE_p_p_char errmsg)
invoke sqlite3_exec() function. |
void |
fileControl(java.lang.String dbName,
int op,
SWIGTYPE_p_void arg)
invoke sqlite3_file_control() function. |
protected void |
finalize()
Close database if database is not closed yet. |
static SWIGTYPE_p_sqlite3_vfs |
findVFS(java.lang.String vfsName)
invoke sqlite3_vfs_find() function. |
boolean |
getAutoCommit()
invoke sqlite3_get_autocommit() function. |
int |
getBusyTimeout()
Returns the value of timeout(ms). |
ColumnMetaData |
getColumnMetaData(java.lang.String dbName,
java.lang.String tableName,
java.lang.String columnName)
invoke sqlite3_table_column_metadata() function. |
int |
getLastError()
invoke sqlite3_errcode() function. |
java.lang.String |
getLastErrorMessage()
invoke sqlite3_errmsg() function. |
static java.lang.String |
getProductName()
It always returns "SQLite". |
java.util.List<java.lang.String[]> |
getTable(java.lang.String sql,
SWIGTYPE_p_p_char errmsg)
invoke sqlite3_get_table() function. |
static long |
highwaterMemory(boolean reset)
Deprecated. |
void |
interrupt()
invoke sqlite3_interrupt() function. |
boolean |
isClosed()
Retrieves whether this Database object has been closed. |
boolean |
isInMemoryMode()
true is returned for the In-Memory mode. |
boolean |
isReadOnly()
Retrieves whether this database is in read-only mode. |
static boolean |
isThreadSafe()
invoke sqlite3_threadsafe() function. |
long |
lastInsertRowId()
invoke sqlite3_last_insert_rowid() function. |
int |
limit(int id,
int newVal)
invoke sqlite3_limit() function. |
void |
loadExtention(java.lang.String filename,
java.lang.String entryPoint,
SWIGTYPE_p_p_char errmsg)
invoke sqlite3_load_extension() function. |
Statement |
nextStatement(Statement stmt)
invoke sqlite3_next_stmt() function. |
protected void |
open(java.lang.String filename)
invoke sqlite3_open() or sqlite3_open_v2() function. |
Blob |
openBlob(java.lang.String dbName,
java.lang.String tableName,
java.lang.String columnName,
long rowId,
int flag)
invoke sqlite3_blob_open() function. |
void |
pragma(java.lang.String[] commands)
execute PRAGMA commands by sqlite3_exec() finction. |
Statement |
prepare(java.lang.String sql)
create UNMANAGED Statement instance. |
Statement |
prepare(java.lang.String sql,
SQLite3.SQLite3StmtPtrPtr ppStmt)
create MANAGED Statement instance. |
java.util.List<Statement> |
prepareMultiple(java.lang.String sql)
create multiple UNMANAGED Statement instance. |
static void |
registerVFS(SWIGTYPE_p_sqlite3_vfs vfs,
boolean makeDefault)
invoke sqlite3_vfs_register() function. |
static void |
resetAutoExtention()
invoke sqlite3_reset_auto_extension() function. |
void |
rollbackTransaction()
rollback transaction. |
void |
setAuthorizer(Authorizer auth)
invoke org.sqlite.auth.Authorizer#register() method. |
void |
setBusyHandler(BusyHandler busy)
invoke org.sqlite.event.BusyHandler#register() method. |
void |
setBusyTimeout(int ms)
invoke sqlite3_busy_timeout() function. |
void |
setCollationNeededHandler(CollationNeededHandler needed)
invoke org.sqlite.event.CollationNeededHandler#register() method. |
void |
setCommitHook(CommitHook hook)
invoke org.sqlite.event.CommitHook#register() method. |
void |
setProfiler(Profiler profiler)
invoke org.sqlite.profiler.Profiler#register() method. |
void |
setProgressHandler(ProgressHandler prog)
invoke org.sqlite.event.ProgressHandler#register() method. |
void |
setRollbackHook(RollbackHook hook)
invoke org.sqlite.event.RollbackHook#register() method. |
void |
setTracer(Tracer tracer)
invoke org.sqlite.profiler.Tracer#register() method. |
void |
setUpdateHook(UpdateHook hook)
invoke org.sqlite.event.UpdateHook#register() method. |
static int[] |
status(int op,
boolean reset)
invoke sqlite3_status() function. |
int |
totalChanges()
invoke sqlite3_total_changes() function. |
static void |
unregisterVFS(SWIGTYPE_p_sqlite3_vfs vfs)
invoke sqlite3_vfs_unregister() function. |
static long |
usedMemory()
Deprecated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final java.util.Map<java.lang.String,java.lang.String> info
Constructor Detail |
---|
public Database(java.lang.String filename, java.util.Map<java.lang.String,java.lang.String> info) throws java.sql.SQLException
filename
- database file pathinfo
- database properties. Changes the temporary directory by "TEMP_DIR" property.
java.sql.SQLException
- When the return value of the sqlite3_open() function is not SQLITE_OK.Method Detail |
---|
public static java.lang.String getProductName()
public boolean isInMemoryMode()
protected void open(java.lang.String filename) throws java.sql.SQLException
filename
- database file path
java.sql.SQLException
- When the return value of the sqlite3_open() or sqlite3_open_v2() function is not SQLITE_OK.public boolean isReadOnly()
public boolean isClosed()
isClosed
in interface Closeable
public void close() throws java.sql.SQLException
close
in interface Closeable
java.sql.SQLException
- When the return value of the sqlite3_close() function is not SQLITE_OK.public boolean getAutoCommit()
public void setBusyTimeout(int ms) throws java.sql.SQLException
ms
- milliseconds
java.sql.SQLException
- When the return value of the sqlite3_busy_timeout() function is not SQLITE_OK.public int getBusyTimeout()
public void execute(java.lang.String sql) throws java.sql.SQLException
sql
- SQL to be evaluated
java.sql.SQLException
- When the return value of the sqlite3_exec() function is not SQLITE_OK.execute(String, ExecCallback, SWIGTYPE_p_p_char)
public void execute(java.lang.String sql, ExecCallback callback, SWIGTYPE_p_p_char errmsg) throws java.sql.SQLException
sql
- SQL to be evaluatedcallback
- callback objecterrmsg
- Error message written here
java.sql.SQLException
- When the return value of the sqlite3_exec() function is not SQLITE_OK.public void pragma(java.lang.String[] commands) throws java.sql.SQLException
commands
- the command list without semicolon
java.sql.SQLException
- When the return value of the sqlite3_exec() function is not SQLITE_OK.execute(String)
public void beginTransaction(TransactionType type) throws java.sql.SQLException
type
- transaction type.
java.sql.SQLException
- When the return value of the sqlite3_exec() function is not SQLITE_OK.public void commitTransaction() throws java.sql.SQLException
java.sql.SQLException
- When the return value of the sqlite3_exec() function is not SQLITE_OK.public void rollbackTransaction() throws java.sql.SQLException
java.sql.SQLException
- When the return value of the sqlite3_exec() function is not SQLITE_OK.public Statement prepare(java.lang.String sql, SQLite3.SQLite3StmtPtrPtr ppStmt) throws java.sql.SQLException
sql
- SQL to be evaluatedppStmt
- SQLite3StmtPtrPtr object
java.sql.SQLException
- When the return value of the sqlite3_prepare_v2() function is not SQLITE_OK.public Statement prepare(java.lang.String sql) throws java.sql.SQLException
sql
- SQL to be evaluated
java.sql.SQLException
- When the return value of the sqlite3_prepare_v2() function is not SQLITE_OK.public java.util.List<Statement> prepareMultiple(java.lang.String sql) throws java.sql.SQLException
sql
- SQL to be evaluated
java.sql.SQLException
- When the return value of the sqlite3_prepare_v2() function is not SQLITE_OK.public void interrupt()
public int changes()
totalChanges()
public int totalChanges()
changes()
public long lastInsertRowId()
public ColumnMetaData getColumnMetaData(java.lang.String dbName, java.lang.String tableName, java.lang.String columnName) throws java.sql.SQLException
dbName
- database nametableName
- table namecolumnName
- column name
java.sql.SQLException
- When the return value of the sqlite3_table_column_metadata() function is not SQLITE_OK.public void createFunction(Function func) throws java.sql.SQLException
func
- User-Defined function
java.sql.SQLException
- When the return value of the sqlite3_create_function() function is not SQLITE_OK.Function.register(org.sqlite.swig.SWIGTYPE_p_sqlite3)
public void dropFunction(Function func) throws java.sql.SQLException
func
- User-Defined function
java.sql.SQLException
- When the return value of the sqlite3_create_function() function is not SQLITE_OK.Function.unregister(org.sqlite.swig.SWIGTYPE_p_sqlite3)
public void createCollationSequence(Collator col) throws java.sql.SQLException
col
- User-Defined Collating Sequences
java.sql.SQLException
- When the return value of the sqlite3_create_collation_v2() function is not SQLITE_OK.Collator.register(org.sqlite.swig.SWIGTYPE_p_sqlite3)
public void dropCollationSequence(Collator col) throws java.sql.SQLException
col
- User-Defined Collating Sequences
java.sql.SQLException
- When the return value of the sqlite3_create_collation() function is not SQLITE_OK.Collator.unregister(org.sqlite.swig.SWIGTYPE_p_sqlite3)
public void setAuthorizer(Authorizer auth) throws java.sql.SQLException
auth
- authorizer
java.sql.SQLException
- When the return value of the sqlite3_set_authorizer() function is not SQLITE_OK.Authorizer.register(org.sqlite.swig.SWIGTYPE_p_sqlite3)
public void clearAuthorizer() throws java.sql.SQLException
java.sql.SQLException
- When the return value of the sqlite3_set_authorizer() function is not SQLITE_OK.Authorizer.unregister(org.sqlite.swig.SWIGTYPE_p_sqlite3)
public void setBusyHandler(BusyHandler busy) throws java.sql.SQLException
busy
- busy handler
java.sql.SQLException
- When the return value of the sqlite3_busy_handler() function is not SQLITE_OK.BusyHandler.register(org.sqlite.swig.SWIGTYPE_p_sqlite3)
public void clearBusyHandler() throws java.sql.SQLException
java.sql.SQLException
- When the return value of the sqlite3_busy_handler() function is not SQLITE_OK.BusyHandler.unregister(org.sqlite.swig.SWIGTYPE_p_sqlite3)
public void setCollationNeededHandler(CollationNeededHandler needed) throws java.sql.SQLException
needed
- the CollationNeededHandler object
java.sql.SQLException
- When the return value of the sqlite3_collation_needed() function is not SQLITE_OK.CollationNeededHandler.register(org.sqlite.swig.SWIGTYPE_p_sqlite3)
,
CollationNeededHandler.setDatabase(Database)
public void clearCollationNeededHandler() throws java.sql.SQLException
java.sql.SQLException
- When the return value of the sqlite3_collation_needed() function is not SQLITE_OK.CollationNeededHandler.unregister(org.sqlite.swig.SWIGTYPE_p_sqlite3)
public void setProgressHandler(ProgressHandler prog)
prog
- progress handlerProgressHandler.register(org.sqlite.swig.SWIGTYPE_p_sqlite3)
public void clearProgressHandler()
ProgressHandler.unregister(org.sqlite.swig.SWIGTYPE_p_sqlite3)
public void setCommitHook(CommitHook hook)
hook
- commit hootCommitHook.register(org.sqlite.swig.SWIGTYPE_p_sqlite3)
public void clearCommitHook()
CommitHook.clear(org.sqlite.swig.SWIGTYPE_p_sqlite3)
public void setRollbackHook(RollbackHook hook)
hook
- rollback hootRollbackHook.register(org.sqlite.swig.SWIGTYPE_p_sqlite3)
public void clearRollbackHook()
RollbackHook.clear(org.sqlite.swig.SWIGTYPE_p_sqlite3)
public void setUpdateHook(UpdateHook hook)
hook
- update hootUpdateHook.register(org.sqlite.swig.SWIGTYPE_p_sqlite3)
public void clearUpdateHook()
UpdateHook.clear(org.sqlite.swig.SWIGTYPE_p_sqlite3)
public void setProfiler(Profiler profiler)
profiler
- profilerProfiler.register(org.sqlite.swig.SWIGTYPE_p_sqlite3)
public void clearProfiler()
Profiler.clear(org.sqlite.swig.SWIGTYPE_p_sqlite3)
public void setTracer(Tracer tracer)
tracer
- tracerTracer.register(org.sqlite.swig.SWIGTYPE_p_sqlite3)
public void clearTracer()
Tracer.clear(org.sqlite.swig.SWIGTYPE_p_sqlite3)
public static void enableSharedCache() throws java.sql.SQLException
java.sql.SQLException
- When the return value of the sqlite3_enable_shared_cache() function is not SQLITE_OK.public static void disableSharedCache() throws java.sql.SQLException
java.sql.SQLException
- When the return value of the sqlite3_enable_shared_cache() function is not SQLITE_OK.public int getLastError()
enableExtendedResultCodes()
,
disableExtendedResultCodes()
public java.lang.String getLastErrorMessage()
getLastError()
,
enableExtendedResultCodes()
,
disableExtendedResultCodes()
public java.util.List<java.lang.String[]> getTable(java.lang.String sql, SWIGTYPE_p_p_char errmsg) throws java.sql.SQLException
sql
- SQL to be evaluatederrmsg
- Error message written here
java.sql.SQLException
- When the return value of the sqlite3_get_table() function is not SQLITE_OK.public void enableExtendedResultCodes() throws java.sql.SQLException
java.sql.SQLException
- When the return value of the sqlite3_extended_result_codes() function is not SQLITE_OK.public void disableExtendedResultCodes() throws java.sql.SQLException
java.sql.SQLException
- When the return value of the sqlite3_extended_result_codes() function is not SQLITE_OK.public void enableLoadExtention() throws java.sql.SQLException
java.sql.SQLException
- When the return value of the sqlite3_enable_load_extension() function is not SQLITE_OK.public void disableLoadExtention() throws java.sql.SQLException
java.sql.SQLException
- When the return value of the sqlite3_enable_load_extension() function is not SQLITE_OK.public void loadExtention(java.lang.String filename, java.lang.String entryPoint, SWIGTYPE_p_p_char errmsg) throws java.sql.SQLException
filename
- the Name of the shared library containing extensionentryPoint
- the Entry point. Use "sqlite3_extension_init" if null.errmsg
- Error message written here
java.sql.SQLException
- When the return value of the sqlite3_load_extension() function is not SQLITE_OK.public static void resetAutoExtention()
public static boolean isThreadSafe()
public static long highwaterMemory(boolean reset)
reset
- true if the memory highwater mark is reset.
status(int, boolean)
public static long usedMemory()
status(int, boolean)
public static SWIGTYPE_p_sqlite3_vfs findVFS(java.lang.String vfsName)
vfsName
- the VFS name are case sensitive.
registerVFS(SWIGTYPE_p_sqlite3_vfs, boolean)
,
unregisterVFS(SWIGTYPE_p_sqlite3_vfs)
public static void registerVFS(SWIGTYPE_p_sqlite3_vfs vfs, boolean makeDefault) throws java.sql.SQLException
vfs
- the VFS object.makeDefault
- Each new VFS becomes the default VFS if the makeDefault flag is true.
java.sql.SQLException
- When the return value of the sqlite3_vfs_register() function is not SQLITE_OK.findVFS(java.lang.String)
,
unregisterVFS(SWIGTYPE_p_sqlite3_vfs)
public static void unregisterVFS(SWIGTYPE_p_sqlite3_vfs vfs) throws java.sql.SQLException
vfs
- the registered VFS object.
java.sql.SQLException
- When the return value of the sqlite3_vfs_unregister() function is not SQLITE_OK.registerVFS(SWIGTYPE_p_sqlite3_vfs, boolean)
public void fileControl(java.lang.String dbName, int op, SWIGTYPE_p_void arg) throws java.sql.SQLException
dbName
- the name "main" or a null.op
- the parameters to this routine are passed directly through to the second parameters of the xFileControl method.arg
- the parameters to this routine are passed directly through to the third parameters of the xFileControl method.
java.sql.SQLException
- When the return value of the sqlite3_file_control() function is not SQLITE_OK.public Blob openBlob(java.lang.String dbName, java.lang.String tableName, java.lang.String columnName, long rowId, int flag) throws java.sql.SQLException
dbName
- the database nametableName
- the table namecolumnName
- the column namerowId
- the ROWIDflag
- If the flags parameter is non-zero, the blob is opened for read and write access. If it is zero, the blob is opened for read access.
java.sql.SQLException
- When the return value of the sqlite3_blob_open() function is not SQLITE_OK.public int limit(int id, int newVal)
id
- an one of the limit categories that define a class of constructs to be size limitednewVal
- the new limit value
public Statement nextStatement(Statement stmt) throws java.sql.SQLException
stmt
- Statement object (null allowed)
java.sql.SQLException
public static int[] status(int op, boolean reset) throws java.sql.SQLException
op
- status parameterreset
- true if the memory highwater mark is reset.
java.sql.SQLException
- When the return value of the sqlite3_status() function is not SQLITE_OK.public int[] connectionStatus(int op, boolean reset) throws java.sql.SQLException
op
- status parameterreset
- true if the memory highwater mark is reset.
java.sql.SQLException
- When the return value of the sqlite3_db_status() function is not SQLITE_OK.protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
close()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |