Package io.roastedroot.sqlite4j.core
Class WasmDB
- java.lang.Object
-
- io.roastedroot.sqlite4j.core.DB
-
- io.roastedroot.sqlite4j.core.WasmDB
-
- All Implemented Interfaces:
Codes,WasmDBImports
public class WasmDB extends DB implements WasmDBImports
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.roastedroot.sqlite4j.core.DB
DB.ProgressObserver
-
-
Field Summary
Fields Modifier and Type Field Description static intPTR_SIZE-
Fields inherited from class io.roastedroot.sqlite4j.core.DB
commitListeners, updateListeners
-
Fields inherited from interface io.roastedroot.sqlite4j.core.Codes
SQLITE_ABORT, SQLITE_AUTH, SQLITE_BLOB, SQLITE_BUSY, SQLITE_CANTOPEN, SQLITE_CONSTRAINT, SQLITE_CORRUPT, SQLITE_DONE, SQLITE_EMPTY, SQLITE_ERROR, SQLITE_FLOAT, SQLITE_FULL, SQLITE_INTEGER, SQLITE_INTERNAL, SQLITE_INTERRUPT, SQLITE_IOERR, SQLITE_LOCKED, SQLITE_MISMATCH, SQLITE_MISUSE, SQLITE_NOLFS, SQLITE_NOMEM, SQLITE_NOTFOUND, SQLITE_NULL, SQLITE_OK, SQLITE_PERM, SQLITE_PROTOCOL, SQLITE_READONLY, SQLITE_ROW, SQLITE_SCHEMA, SQLITE_TEXT, SQLITE_TOOBIG
-
-
Constructor Summary
Constructors Constructor Description WasmDB(FileSystem fs, String url, String fileName, SQLiteConfig config, boolean isMemory)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void_close()Closes the SQLite interface to a database.int_exec(String sql)Complies, evaluates, executes and commits an SQL statement.protected void_open(String filename, int openFlags)Creates an SQLite interface to a database with the provided open flags.intbackup(String dbName, String destFileName, DB.ProgressObserver observer)intbackup(String dbName, String destFileName, DB.ProgressObserver observer, int sleepTimeMillis, int nTimeoutLimit, int pagesPerStep)voidbusy_handler(BusyHandler busyHandler)Sets a busy handler that sleeps for a specified amount of time when a table is locked.voidbusy_timeout(int ms)Sets a busy handler that sleeps for a specified amount of time when a table is locked.longchanges()intclear_bindings(long stmtPtrPtr)Reset all bindings on a prepared statement (reset all host parameters to NULL).voidclear_progress_handler()byte[]column_blob(long stmtPtrPtr, int col)intcolumn_count(long stmtPtrPtr)Stringcolumn_decltype(long stmtPtrPtr, int col)doublecolumn_double(long stmtPtrPtr, int col)intcolumn_int(long stmtPtrPtr, int col)longcolumn_long(long stmtPtrPtr, int col)Stringcolumn_name(long stmtPtrPtr, int col)Stringcolumn_table_name(long stmtPtrPtr, int col)Stringcolumn_text(long stmtPtrPtr, int col)intcolumn_type(long stmtPtrPtr, int col)intcreate_collation(String name, Collation c)Create a user defined collation with given collation name and the collation object.intcreate_function(String name, Function f, int nArgs, int flags)Create a user defined function with given function name and the function object.voiddeserialize(String schema, byte[] buff)intdestroy_collation(String name)Create a user defined collation with given collation name and the collation object.intdestroy_function(String name)De-registers a user defined functionintenable_load_extension(boolean enable)Enables or disables loading of SQLite extensions.protected intfinalize(long stmtPtrPtr)Destroys a prepared statement.voidinterrupt()Aborts any pending operation and returns at its earliest opportunity.Stringlibversion()Returns the value for SQLITE_VERSION, SQLITE_VERSION_NUMBER, and SQLITE_SOURCE_ID C preprocessor macros that are associated with the library.intlimit(int id, int value)protected SafeStmtPtrprepare(String sql)Complies an SQL statement.voidregister_progress_handler(int vmCalls, ProgressHandler progressHandler)Progress handlerintreset(long stmtPtrPtr)Sets a prepared statement object back to its initial state, ready to be re-executed.intrestore(String dbName, String sourceFileName, DB.ProgressObserver observer)intrestore(String dbName, String sourceFileName, DB.ProgressObserver observer, int sleepTimeMillis, int nTimeoutLimit, int pagesPerStep)voidresult_blob(long context, byte[] v)Sets the result of an SQL function as blob data type with the pointer to the SQLite database context and the the result value of byte array.voidresult_double(long context, double val)Sets the result of an SQL function as double data type with the pointer to the SQLite database context and the the result value of double.voidresult_error(long context, String err)Sets the result of an SQL function as an error with the pointer to the SQLite database context and the the error of String.voidresult_int(long context, int val)Sets the result of an SQL function as int data type with the pointer to the SQLite database context and the the result value of int.voidresult_long(long context, long val)Sets the result of an SQL function as long data type with the pointer to the SQLite database context and the the result value of long.voidresult_null(long context)Sets the result of an SQL function as NULL with the pointer to the SQLite database context.voidresult_text(long context, String val)Sets the result of an SQL function as text data type with the pointer to the SQLite database context and the the result value of String.byte[]serialize(String schema)intshared_cache(boolean enable)Enables or disables the sharing of the database cache and schema data structures between connections to the same database.intstep(long stmtPtrPtr)Evaluates a statement.longtotal_changes()byte[]value_blob(Function f, int arg)doublevalue_double(Function f, int arg)intvalue_int(Function f, int arg)Accesses the parameter values on the function or aggregate in int data type with the function object and the parameter value.longvalue_long(Function f, int arg)Stringvalue_text(Function f, int arg)intvalue_type(Function f, int arg)static Stringversion()intxBusy(int userData, int nbPrevInvok)intxCommit(int userData)intxCompare(int ctx, int len1, int str1Ptr, int len2, int str2Ptr)voidxDestroy(int funIdx)voidxDestroyCollation(int funIdx)voidxFinal(int ctx)voidxFunc(int ctx, int argN, int value)voidxInverse(int ctx, int argN, int value)intxProgress(int userData)voidxRollback(int userData)voidxStep(int ctx, int argN, int value)voidxUpdate(int userData, int tpe, int dbNamePtr, int tablePtr, long rowId)voidxValue(int ctx)-
Methods inherited from class io.roastedroot.sqlite4j.core.DB
addCommitListener, addUpdateListener, close, column_names, exec, execute, executeUpdate, finalize, getConfig, getUrl, isClosed, newSQLException, open, prepare, removeCommitListener, removeUpdateListener, throwex
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.roastedroot.sqlite4j.core.wasm.WasmDBImports
toHostFunctions
-
-
-
-
Field Detail
-
PTR_SIZE
public static final int PTR_SIZE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
WasmDB
public WasmDB(FileSystem fs, String url, String fileName, SQLiteConfig config, boolean isMemory) throws SQLException
- Throws:
SQLException
-
-
Method Detail
-
xProgress
public int xProgress(int userData)
- Specified by:
xProgressin interfaceWasmDBImports
-
xBusy
public int xBusy(int userData, int nbPrevInvok)- Specified by:
xBusyin interfaceWasmDBImports
-
xDestroy
public void xDestroy(int funIdx)
- Specified by:
xDestroyin interfaceWasmDBImports
-
xFinal
public void xFinal(int ctx)
- Specified by:
xFinalin interfaceWasmDBImports
-
xValue
public void xValue(int ctx)
- Specified by:
xValuein interfaceWasmDBImports
-
xFunc
public void xFunc(int ctx, int argN, int value)- Specified by:
xFuncin interfaceWasmDBImports
-
xStep
public void xStep(int ctx, int argN, int value)- Specified by:
xStepin interfaceWasmDBImports
-
xInverse
public void xInverse(int ctx, int argN, int value)- Specified by:
xInversein interfaceWasmDBImports
-
xCompare
public int xCompare(int ctx, int len1, int str1Ptr, int len2, int str2Ptr)- Specified by:
xComparein interfaceWasmDBImports
-
xDestroyCollation
public void xDestroyCollation(int funIdx)
- Specified by:
xDestroyCollationin interfaceWasmDBImports
-
xUpdate
public void xUpdate(int userData, int tpe, int dbNamePtr, int tablePtr, long rowId)- Specified by:
xUpdatein interfaceWasmDBImports
-
xCommit
public int xCommit(int userData)
- Specified by:
xCommitin interfaceWasmDBImports
-
xRollback
public void xRollback(int userData)
- Specified by:
xRollbackin interfaceWasmDBImports
-
_open
protected void _open(String filename, int openFlags) throws SQLException
Description copied from class:DBCreates an SQLite interface to a database with the provided open flags.- Specified by:
_openin classDB- Parameters:
filename- The database to open.openFlags- File opening configurations (https://www.sqlite.org/c3ref/c_open_autoproxy.html)- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/open.html
-
prepare
protected SafeStmtPtr prepare(String sql) throws SQLException
Description copied from class:DBComplies an SQL statement.- Specified by:
preparein classDB- Parameters:
sql- An SQL statement.- Returns:
- Result Codes
- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/prepare.html
-
finalize
protected int finalize(long stmtPtrPtr) throws SQLExceptionDescription copied from class:DBDestroys a prepared statement.- Specified by:
finalizein classDB- Parameters:
stmtPtrPtr- Pointer to the statement pointer.- Returns:
- Result Codes
- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/finalize.html
-
step
public int step(long stmtPtrPtr) throws SQLExceptionDescription copied from class:DBEvaluates a statement.- Specified by:
stepin classDB- Parameters:
stmtPtrPtr- Pointer to the statement.- Returns:
- Result Codes
- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/step.html
-
_exec
public int _exec(String sql) throws SQLException
Description copied from class:DBComplies, evaluates, executes and commits an SQL statement.- Specified by:
_execin classDB- Parameters:
sql- An SQL statement.- Returns:
- Result Codes
- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/exec.html
-
changes
public long changes() throws SQLException- Specified by:
changesin classDB- Returns:
- Number of rows that were changed, inserted or deleted by the last SQL statement
- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/changes.html
-
interrupt
public void interrupt() throws SQLExceptionDescription copied from class:DBAborts any pending operation and returns at its earliest opportunity.- Specified by:
interruptin classDB- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/interrupt.html
-
busy_timeout
public void busy_timeout(int ms) throws SQLExceptionDescription copied from class:DBSets a busy handler that sleeps for a specified amount of time when a table is locked.- Specified by:
busy_timeoutin classDB- Parameters:
ms- Time to sleep in milliseconds.- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/busy_timeout.html
-
busy_handler
public void busy_handler(BusyHandler busyHandler) throws SQLException
Description copied from class:DBSets a busy handler that sleeps for a specified amount of time when a table is locked.- Specified by:
busy_handlerin classDB- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/busy_timeout.html
-
libversion
public String libversion() throws SQLException
Description copied from class:DBReturns the value for SQLITE_VERSION, SQLITE_VERSION_NUMBER, and SQLITE_SOURCE_ID C preprocessor macros that are associated with the library.- Specified by:
libversionin classDB- Returns:
- Compile-time SQLite version information.
- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/libversion.html, https://www.sqlite.org/c3ref/c_source_id.html
-
total_changes
public long total_changes() throws SQLException- Specified by:
total_changesin classDB- Returns:
- Number of row changes caused by INSERT, UPDATE or DELETE statements since the database connection was opened.
- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/total_changes.html
-
shared_cache
public int shared_cache(boolean enable) throws SQLExceptionDescription copied from class:DBEnables or disables the sharing of the database cache and schema data structures between connections to the same database.- Specified by:
shared_cachein classDB- Parameters:
enable- True to enable; false otherwise.- Returns:
- Result Codes
- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/enable_shared_cache.html,
SQLiteErrorCode
-
enable_load_extension
public int enable_load_extension(boolean enable) throws SQLExceptionDescription copied from class:DBEnables or disables loading of SQLite extensions.- Specified by:
enable_load_extensionin classDB- Parameters:
enable- True to enable; false otherwise.- Returns:
- Result Codes
- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/load_extension.html
-
_close
protected void _close() throws SQLExceptionDescription copied from class:DBCloses the SQLite interface to a database.- Specified by:
_closein classDB- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/close.html
-
reset
public int reset(long stmtPtrPtr) throws SQLExceptionDescription copied from class:DBSets a prepared statement object back to its initial state, ready to be re-executed.- Specified by:
resetin classDB- Parameters:
stmtPtrPtr- Pointer to the statement.- Returns:
- Result Codes
- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/reset.html
-
clear_bindings
public int clear_bindings(long stmtPtrPtr) throws SQLExceptionDescription copied from class:DBReset all bindings on a prepared statement (reset all host parameters to NULL).- Specified by:
clear_bindingsin classDB- Parameters:
stmtPtrPtr- Pointer to the statement.- Returns:
- Result Codes
- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/clear_bindings.html
-
column_count
public int column_count(long stmtPtrPtr) throws SQLException- Specified by:
column_countin classDB- Parameters:
stmtPtrPtr- Pointer to the statement.- Returns:
- Number of columns in the result set returned by the prepared statement.
- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/column_count.html
-
column_type
public int column_type(long stmtPtrPtr, int col) throws SQLException- Specified by:
column_typein classDB- Parameters:
stmtPtrPtr- Pointer to the statement.col- Number of column.- Returns:
- Datatype code for the initial data type of the result column.
- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/column_blob.html
-
column_decltype
public String column_decltype(long stmtPtrPtr, int col) throws SQLException
- Specified by:
column_decltypein classDB- Parameters:
stmtPtrPtr- Pointer to the statement.col- Number of column.- Returns:
- Declared type of the table column for prepared statement.
- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/column_decltype.html
-
column_table_name
public String column_table_name(long stmtPtrPtr, int col) throws SQLException
- Specified by:
column_table_namein classDB- Parameters:
stmtPtrPtr- Pointer to the statement.col- Number of column.- Returns:
- Original text of column name which is the declared in the CREATE TABLE statement.
- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/column_database_name.html
-
column_name
public String column_name(long stmtPtrPtr, int col) throws SQLException
- Specified by:
column_namein classDB- Parameters:
stmtPtrPtr- Pointer to the statement.col- The number of column.- Returns:
- Name assigned to a particular column in the result set of a SELECT statement.
- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/column_name.html
-
column_text
public String column_text(long stmtPtrPtr, int col) throws SQLException
- Specified by:
column_textin classDB- Parameters:
stmtPtrPtr- Pointer to the statement.col- Number of column.- Returns:
- Value of the column as text data type in the result set of a SELECT statement.
- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/column_blob.html
-
column_blob
public byte[] column_blob(long stmtPtrPtr, int col) throws SQLException- Specified by:
column_blobin classDB- Parameters:
stmtPtrPtr- Pointer to the statement.col- Number of column.- Returns:
- BLOB value of the column in the result set of a SELECT statement
- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/column_blob.html
-
column_double
public double column_double(long stmtPtrPtr, int col) throws SQLException- Specified by:
column_doublein classDB- Parameters:
stmtPtrPtr- Pointer to the statement.col- Number of column.- Returns:
- DOUBLE value of the column in the result set of a SELECT statement
- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/column_blob.html
-
column_long
public long column_long(long stmtPtrPtr, int col) throws SQLException- Specified by:
column_longin classDB- Parameters:
stmtPtrPtr- Pointer to the statement.col- Number of column.- Returns:
- LONG value of the column in the result set of a SELECT statement.
- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/column_blob.html
-
column_int
public int column_int(long stmtPtrPtr, int col) throws SQLException- Specified by:
column_intin classDB- Parameters:
stmtPtrPtr- Pointer to the statement.col- Number of column.- Returns:
- INT value of column in the result set of a SELECT statement.
- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/column_blob.html
-
result_null
public void result_null(long context) throws SQLExceptionDescription copied from class:DBSets the result of an SQL function as NULL with the pointer to the SQLite database context.- Specified by:
result_nullin classDB- Parameters:
context- Pointer to the SQLite database context.- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/result_blob.html
-
result_text
public void result_text(long context, String val) throws SQLExceptionDescription copied from class:DBSets the result of an SQL function as text data type with the pointer to the SQLite database context and the the result value of String.- Specified by:
result_textin classDB- Parameters:
context- Pointer to the SQLite database context.val- Result value of an SQL function.- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/result_blob.html
-
result_blob
public void result_blob(long context, byte[] v) throws SQLExceptionDescription copied from class:DBSets the result of an SQL function as blob data type with the pointer to the SQLite database context and the the result value of byte array.- Specified by:
result_blobin classDB- Parameters:
context- Pointer to the SQLite database context.v- Result value of an SQL function.- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/result_blob.html
-
result_double
public void result_double(long context, double val) throws SQLExceptionDescription copied from class:DBSets the result of an SQL function as double data type with the pointer to the SQLite database context and the the result value of double.- Specified by:
result_doublein classDB- Parameters:
context- Pointer to the SQLite database context.val- Result value of an SQL function.- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/result_blob.html
-
result_long
public void result_long(long context, long val) throws SQLExceptionDescription copied from class:DBSets the result of an SQL function as long data type with the pointer to the SQLite database context and the the result value of long.- Specified by:
result_longin classDB- Parameters:
context- Pointer to the SQLite database context.val- Result value of an SQL function.- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/result_blob.html
-
result_int
public void result_int(long context, int val) throws SQLExceptionDescription copied from class:DBSets the result of an SQL function as int data type with the pointer to the SQLite database context and the the result value of int.- Specified by:
result_intin classDB- Parameters:
context- Pointer to the SQLite database context.val- Result value of an SQL function.- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/result_blob.html
-
result_error
public void result_error(long context, String err) throws SQLExceptionDescription copied from class:DBSets the result of an SQL function as an error with the pointer to the SQLite database context and the the error of String.- Specified by:
result_errorin classDB- Parameters:
context- Pointer to the SQLite database context.err- Error result of an SQL function.- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/result_blob.html
-
value_text
public String value_text(Function f, int arg) throws SQLException
- Specified by:
value_textin classDB- Parameters:
f- SQLite function object.arg- Pointer to the parameter of the SQLite function or aggregate.- Returns:
- Parameter value of the given SQLite function or aggregate in text data type.
- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/value_blob.html
-
value_blob
public byte[] value_blob(Function f, int arg) throws SQLException
- Specified by:
value_blobin classDB- Parameters:
f- SQLite function object.arg- Pointer to the parameter of the SQLite function or aggregate.- Returns:
- Parameter value of the given SQLite function or aggregate in blob data type.
- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/value_blob.html
-
value_double
public double value_double(Function f, int arg) throws SQLException
- Specified by:
value_doublein classDB- Parameters:
f- SQLite function object.arg- Pointer to the parameter of the SQLite function or aggregate.- Returns:
- Parameter value of the given SQLite function or aggregate in double data type
- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/value_blob.html
-
value_long
public long value_long(Function f, int arg) throws SQLException
- Specified by:
value_longin classDB- Parameters:
f- SQLite function object.arg- Pointer to the parameter of the SQLite function or aggregate.- Returns:
- Parameter value of the given SQLite function or aggregate in long data type.
- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/value_blob.html
-
value_int
public int value_int(Function f, int arg) throws SQLException
Description copied from class:DBAccesses the parameter values on the function or aggregate in int data type with the function object and the parameter value.- Specified by:
value_intin classDB- Parameters:
f- SQLite function object.arg- Pointer to the parameter of the SQLite function or aggregate.- Returns:
- Parameter value of the given SQLite function or aggregate.
- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/value_blob.html
-
value_type
public int value_type(Function f, int arg) throws SQLException
- Specified by:
value_typein classDB- Parameters:
f- SQLite function object.arg- Pointer to the parameter of the SQLite function or aggregate.- Returns:
- Parameter datatype of the function or aggregate in int data type.
- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/value_blob.html
-
create_function
public int create_function(String name, Function f, int nArgs, int flags) throws SQLException
Description copied from class:DBCreate a user defined function with given function name and the function object.- Specified by:
create_functionin classDB- Parameters:
name- The function name to be created.f- SQLite function object.flags- Extra flags to use when creating the function, such asFunction.FLAG_DETERMINISTIC- Returns:
- Result Codes
- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/create_function.html
-
destroy_function
public int destroy_function(String name) throws SQLException
Description copied from class:DBDe-registers a user defined function- Specified by:
destroy_functionin classDB- Parameters:
name- Name of the function to de-registered.- Returns:
- Result Codes
- Throws:
SQLException
-
create_collation
public int create_collation(String name, Collation c) throws SQLException
Description copied from class:DBCreate a user defined collation with given collation name and the collation object.- Specified by:
create_collationin classDB- Parameters:
name- The collation name to be created.c- SQLite collation object.- Returns:
- Result Codes
- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/create_collation.html
-
destroy_collation
public int destroy_collation(String name) throws SQLException
Description copied from class:DBCreate a user defined collation with given collation name and the collation object.- Specified by:
destroy_collationin classDB- Parameters:
name- The collation name to be created.- Returns:
- Result Codes
- Throws:
SQLException
-
backup
public int backup(String dbName, String destFileName, DB.ProgressObserver observer) throws SQLException
- Specified by:
backupin classDB- Parameters:
dbName- Database name to be backed up.destFileName- Target backup file name.observer- ProgressObserver object.- Returns:
- Result Codes
- Throws:
SQLException
-
backup
public int backup(String dbName, String destFileName, DB.ProgressObserver observer, int sleepTimeMillis, int nTimeoutLimit, int pagesPerStep) throws SQLException
- Specified by:
backupin classDB- Parameters:
dbName- Database name to be backed up.destFileName- Target backup file name.observer- ProgressObserver object.sleepTimeMillis- time to wait during a backup/restore operation if sqlite3_backup_step returns SQLITE_BUSY before continuingnTimeoutLimit- the number of times sqlite3_backup_step can return SQLITE_BUSY before failingpagesPerStep- the number of pages to copy in each sqlite3_backup_step. If this is negative, the entire DB is copied at once.- Returns:
- Result Codes
- Throws:
SQLException
-
restore
public int restore(String dbName, String sourceFileName, DB.ProgressObserver observer) throws SQLException
- Specified by:
restorein classDB- Parameters:
dbName- Database name for restoring data.sourceFileName- Source file name.observer- ProgressObserver object.- Returns:
- Result Codes
- Throws:
SQLException
-
restore
public int restore(String dbName, String sourceFileName, DB.ProgressObserver observer, int sleepTimeMillis, int nTimeoutLimit, int pagesPerStep) throws SQLException
- Specified by:
restorein classDB- Parameters:
dbName- the name of the db to restoresourceFileName- the filename of the source db to restoreobserver- ProgressObserver object.sleepTimeMillis- time to wait during a backup/restore operation if sqlite3_backup_step returns SQLITE_BUSY before continuingnTimeoutLimit- the number of times sqlite3_backup_step can return SQLITE_BUSY before failingpagesPerStep- the number of pages to copy in each sqlite3_backup_step. If this is negative, the entire DB is copied at once.- Returns:
- Result Codes
- Throws:
SQLException
-
limit
public int limit(int id, int value) throws SQLException- Specified by:
limitin classDB- Parameters:
id- The id of the limit.value- The new value of the limit.- Returns:
- The prior value of the limit
- Throws:
SQLException- See Also:
- https://www.sqlite.org/c3ref/limit.html
-
register_progress_handler
public void register_progress_handler(int vmCalls, ProgressHandler progressHandler) throws SQLExceptionDescription copied from class:DBProgress handler- Specified by:
register_progress_handlerin classDB- Throws:
SQLException
-
clear_progress_handler
public void clear_progress_handler() throws SQLException- Specified by:
clear_progress_handlerin classDB- Throws:
SQLException
-
serialize
public byte[] serialize(String schema) throws SQLException
- Specified by:
serializein classDB- Throws:
SQLException
-
deserialize
public void deserialize(String schema, byte[] buff) throws SQLException
- Specified by:
deserializein classDB- Throws:
SQLException
-
version
public static String version()
-
-