|
||||||||||
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.
NOTE: SQLite 3.3.17 based.
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 sqlite3_set_authorizer() function. |
void |
clearBusyHandler()
invoke sqlite3_set_authorizer() function. |
void |
clearCollationNeededHandler()
invoke sqlite3_collation_needed() function. |
void |
clearCommitHook()
invoke sqlite3_commit_hook() function. |
void |
clearProfiler()
invoke sqlite3_profile() function. |
void |
clearProgressHandler()
invoke sqlite3_progress_handler() function. |
void |
clearRollbackHook()
invoke sqlite3_rollback_hook() function. |
void |
clearTracer()
invoke sqlite3_trace() function. |
void |
clearUpdateHook()
invoke sqlite3_update_hook() function. |
void |
close()
invoke sqlite3_close() function. |
void |
commitTransaction()
commit toransaction. |
void |
createCollationSequence(Collator col)
invoke sqlite3_create_collation() function. |
void |
createFunction(Function func)
invoke sqlite3_create_function() function. |
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 sqlite3_create_function() function. |
void |
dropCollationSequence(java.lang.String name)
invoke sqlite3_create_function() function. |
void |
dropFunction(Function func)
invoke sqlite3_create_function() function. |
void |
dropFunction(java.lang.String name)
invoke sqlite3_create_function() function. |
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. |
protected void |
finalize()
Close database if database is not closed yet. |
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. |
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. |
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()
It always returns false. NOTE: The sqlite3_open_v2() function is not supported in this version. |
long |
lastInsertRowId()
invoke sqlite3_last_insert_rowid() function. |
void |
loadExtention(java.lang.String filename,
java.lang.String entryPoint,
SWIGTYPE_p_p_char errmsg)
invoke sqlite3_load_extension() function. |
protected void |
open(java.lang.String filename)
invoke sqlite3_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 |
resetAutoExtention()
invoke sqlite3_reset_auto_extension() function. |
void |
rollbackTransaction()
rollback transaction. |
void |
setAuthorizer(Authorizer auth)
invoke sqlite3_set_authorizer() function. |
void |
setBusyHandler(BusyHandler busy)
invoke sqlite3_busy_handler() function. |
void |
setBusyTimeout(int ms)
invoke sqlite3_busy_timeout() function. |
void |
setCollationNeededHandler(CollationNeededHandler needed)
invoke sqlite3_collation_needed() function. |
void |
setCommitHook(CommitHook hook)
invoke sqlite3_commit_hook() function. |
void |
setProfiler(Profiler profiler)
invoke sqlite3_profile() function. |
void |
setProgressHandler(ProgressHandler prog)
invoke sqlite3_progress_handler() function. |
void |
setRollbackHook(RollbackHook hook)
invoke sqlite3_rollback_hook() function. |
void |
setTracer(Tracer tracer)
invoke sqlite3_trace() function. |
void |
setUpdateHook(UpdateHook hook)
invoke sqlite3_update_hook() function. |
int |
totalChanges()
invoke sqlite3_total_changes() function. |
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 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() function is not SQLITE_OK.public boolean isReadOnly()
public boolean isClosed()
public void close() throws java.sql.SQLException
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() 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() 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() 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.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.public void dropFunction(java.lang.String name) throws java.sql.SQLException
name
- the function name
java.sql.SQLException
- When the return value of the sqlite3_create_function() function is not SQLITE_OK.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() function is not SQLITE_OK.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.public void dropCollationSequence(java.lang.String name) throws java.sql.SQLException
name
- the collation sequence name
java.sql.SQLException
- When the return value of the sqlite3_create_collation() function is not SQLITE_OK.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.public void clearAuthorizer() throws java.sql.SQLException
java.sql.SQLException
- When the return value of the sqlite3_set_authorizer() function is not SQLITE_OK.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.public void clearBusyHandler() throws java.sql.SQLException
java.sql.SQLException
- When the return value of the sqlite3_busy_handler() function is not SQLITE_OK.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.public void clearCollationNeededHandler() throws java.sql.SQLException
java.sql.SQLException
- When the return value of the sqlite3_collation_needed() function is not SQLITE_OK.public void setProgressHandler(ProgressHandler prog)
prog
- progress handlerpublic void clearProgressHandler()
public void setCommitHook(CommitHook hook)
hook
- commit hootpublic void clearCommitHook()
public void setRollbackHook(RollbackHook hook)
hook
- rollback hootpublic void clearRollbackHook()
public void setUpdateHook(UpdateHook hook)
hook
- update hootpublic void clearUpdateHook()
public void setProfiler(Profiler profiler)
profiler
- profilerpublic void clearProfiler()
public void setTracer(Tracer tracer)
tracer
- tracerpublic void clearTracer()
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()
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 |