Package org.sqlite.core
Class NativeDB
java.lang.Object
org.sqlite.core.DB
org.sqlite.core.NativeDB
- All Implemented Interfaces:
Codes
This class provides a thin JNI layer over the SQLite3 C API.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.sqlite.core.DB
DB.ProgressObserver
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate long
busy handler pointer to JNI global busyhandler reference.private long
private static final int
private static final int
private static final int
private static boolean
private static boolean
private static final Logger
private long
SQLite connection handle.private long
handler pointer to JNI global progressHandler reference.private long
Fields inherited from interface org.sqlite.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 -
Method Summary
Modifier and TypeMethodDescriptionprotected void
_close()
Closes the SQLite interface to a database.int
Complies, evaluates, executes and commits an SQL statement.(package private) int
_exec_utf8
(byte[] sqlUtf8) protected void
Creates an SQLite interface to a database with the provided open flags.(package private) void
_open_utf8
(byte[] fileUtf8, int openFlags) (package private) int
backup
(byte[] dbNameUtf8, byte[] destFileNameUtf8, DB.ProgressObserver observer, int sleepTimeMillis, int nTimeouts, int pagesPerStep) int
backup
(String dbName, String destFileName, DB.ProgressObserver observer) int
backup
(String dbName, String destFileName, DB.ProgressObserver observer, int sleepTimeMillis, int nTimeouts, int pagesPerStep) (package private) int
bind_blob
(long stmt, int pos, byte[] v) Binds blob value to prepared statements with the pointer to the statement object, the index of the SQL parameter to be set and the value to bind to the parameter.(package private) int
bind_double
(long stmt, int pos, double v) Binds double value to prepared statements with the pointer to the statement object, the index of the SQL parameter to be set and the value to bind to the parameter.(package private) int
bind_int
(long stmt, int pos, int v) Binds int value to prepared statements with the pointer to the statement object, the index of the SQL parameter to be set and the value to bind to the parameter.(package private) int
bind_long
(long stmt, int pos, long v) Binds long value to prepared statements with the pointer to the statement object, the index of the SQL parameter to be set and the value to bind to the parameter.(package private) int
bind_null
(long stmt, int pos) Binds NULL value to prepared statements with the pointer to the statement object and the index of the SQL parameter to be set to NULL.(package private) int
bind_parameter_count
(long stmt) (package private) int
Binds text value to prepared statements with the pointer to the statement object, the index of the SQL parameter to be set and the value to bind to the parameter.(package private) int
bind_text_utf8
(long stmt, int pos, byte[] vUtf8) void
busy_handler
(BusyHandler busyHandler) Sets a busy handler that sleeps for a specified amount of time when a table is locked.void
busy_timeout
(int ms) Sets a busy handler that sleeps for a specified amount of time when a table is locked.long
changes()
int
clear_bindings
(long stmt) Reset all bindings on a prepared statement (reset all host parameters to NULL).void
byte[]
column_blob
(long stmt, int col) int
column_count
(long stmt) column_decltype
(long stmt, int col) (package private) ByteBuffer
column_decltype_utf8
(long stmt, int col) double
column_double
(long stmt, int col) int
column_int
(long stmt, int col) long
column_long
(long stmt, int col) (package private) boolean[][]
column_metadata
(long stmt) Provides metadata for table columns.column_name
(long stmt, int col) (package private) ByteBuffer
column_name_utf8
(long stmt, int col) column_table_name
(long stmt, int col) (package private) ByteBuffer
column_table_name_utf8
(long stmt, int col) column_text
(long stmt, int col) (package private) ByteBuffer
column_text_utf8
(long stmt, int col) int
column_type
(long stmt, int col) int
create_collation
(String name, Collation coll) Create a user defined collation with given collation name and the collation object.(package private) int
create_collation_utf8
(byte[] nameUtf8, Collation coll) int
create_function
(String name, Function func, int nArgs, int flags) Create a user defined function with given function name and the function object.(package private) int
create_function_utf8
(byte[] nameUtf8, Function func, int nArgs, int flags) void
deserialize
(String schema, byte[] buff) int
destroy_collation
(String name) Create a user defined collation with given collation name and the collation object.(package private) int
destroy_collation_utf8
(byte[] nameUtf8) int
destroy_function
(String name) De-registers a user defined function(package private) int
destroy_function_utf8
(byte[] nameUtf8) int
enable_load_extension
(boolean enable) Enables or disables loading of SQLite extensions.(package private) String
errmsg()
Return English-language text that describes the error as either UTF-8 or UTF-16.(package private) ByteBuffer
protected int
finalize
(long stmt) Destroys a prepared statement.(package private) long
Getter for native pointer to validate memory is properly cleaned up in unit tests(package private) long
Getter for native pointer to validate memory is properly cleaned up in unit tests(package private) long
Getter for native pointer to validate memory is properly cleaned up in unit tests(package private) long
Getter for native pointer to validate memory is properly cleaned up in unit testsvoid
Aborts any pending operation and returns at its earliest opportunity.Returns the value for SQLITE_VERSION, SQLITE_VERSION_NUMBER, and SQLITE_SOURCE_ID C preprocessor macros that are associated with the library.(package private) ByteBuffer
int
limit
(int id, int value) static boolean
load()
Loads the SQLite interface backend.private byte[]
nameToUtf8ByteArray
(String nameType, String name) protected SafeStmtPtr
Complies an SQL statement.(package private) long
prepare_utf8
(byte[] sqlUtf8) void
register_progress_handler
(int vmCalls, ProgressHandler progressHandler) Progress handlerint
reset
(long stmt) Sets a prepared statement object back to its initial state, ready to be re-executed.(package private) int
restore
(byte[] dbNameUtf8, byte[] sourceFileName, DB.ProgressObserver observer, int sleepTimeMillis, int nTimeouts, int pagesPerStep) int
restore
(String dbName, String sourceFileName, DB.ProgressObserver observer) int
restore
(String dbName, String sourceFileName, DB.ProgressObserver observer, int sleepTimeMillis, int nTimeouts, int pagesPerStep) void
result_blob
(long context, byte[] val) 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.void
result_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.void
result_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.(package private) void
result_error_utf8
(long context, byte[] errUtf8) void
result_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.void
result_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.void
result_null
(long context) Sets the result of an SQL function as NULL with the pointer to the SQLite database context.void
result_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.(package private) void
result_text_utf8
(long context, byte[] valUtf8) byte[]
(package private) void
set_commit_listener
(boolean enabled) (package private) void
set_update_listener
(boolean enabled) int
shared_cache
(boolean enable) Enables or disables the sharing of the database cache and schema data structures between connections to the same database.int
step
(long stmt) Evaluates a statement.(package private) static byte[]
(package private) static void
Throws an SQLException.long
(package private) static String
utf8ByteBufferToString
(ByteBuffer buffer) byte[]
value_blob
(Function f, int arg) double
value_double
(Function f, int arg) int
Accesses the parameter values on the function or aggregate in int data type with the function object and the parameter value.long
value_long
(Function f, int arg) value_text
(Function f, int arg) (package private) ByteBuffer
value_text_utf8
(Function f, int argUtf8) int
value_type
(Function f, int arg) Methods inherited from class org.sqlite.core.DB
addCommitListener, addUpdateListener, close, column_names, ensureAutoCommit, exec, execute, execute, executeBatch, executeUpdate, finalize, getConfig, getUrl, isClosed, newSQLException, onCommit, onUpdate, open, prepare, removeCommitListener, removeUpdateListener, sqlbind, throwex, throwex, throwex
-
Field Details
-
logger
-
DEFAULT_BACKUP_BUSY_SLEEP_TIME_MILLIS
private static final int DEFAULT_BACKUP_BUSY_SLEEP_TIME_MILLIS- See Also:
-
DEFAULT_BACKUP_NUM_BUSY_BEFORE_FAIL
private static final int DEFAULT_BACKUP_NUM_BUSY_BEFORE_FAIL- See Also:
-
DEFAULT_PAGES_PER_BACKUP_STEP
private static final int DEFAULT_PAGES_PER_BACKUP_STEP- See Also:
-
pointer
private long pointerSQLite connection handle. -
isLoaded
private static boolean isLoaded -
loadSucceeded
private static boolean loadSucceeded -
busyHandler
private long busyHandlerbusy handler pointer to JNI global busyhandler reference. -
commitListener
private long commitListener -
updateListener
private long updateListener -
progressHandler
private long progressHandlerhandler pointer to JNI global progressHandler reference.
-
-
Constructor Details
-
NativeDB
- Throws:
SQLException
-
-
Method Details
-
load
Loads the SQLite interface backend.- Returns:
- True if the SQLite JDBC driver is successfully loaded; false otherwise.
- Throws:
Exception
-
_open
Description copied from class:DB
Creates an SQLite interface to a database with the provided open flags.- Specified by:
_open
in classDB
- Parameters:
file
- The database to open.openFlags
- File opening configurations (https://www.sqlite.org/c3ref/c_open_autoproxy.html)- Throws:
SQLException
- See Also:
-
_open_utf8
- Throws:
SQLException
-
_close
Description copied from class:DB
Closes the SQLite interface to a database.- Specified by:
_close
in classDB
- Throws:
SQLException
- See Also:
-
_exec
Description copied from class:DB
Complies, evaluates, executes and commits an SQL statement.- Specified by:
_exec
in classDB
- Parameters:
sql
- An SQL statement.- Returns:
- Result Codes
- Throws:
SQLException
- See Also:
-
_exec_utf8
- Throws:
SQLException
-
enable_load_extension
public int enable_load_extension(boolean enable) Description copied from class:DB
Enables or disables loading of SQLite extensions.- Specified by:
enable_load_extension
in classDB
- Parameters:
enable
- True to enable; false otherwise.- Returns:
- Result Codes
- See Also:
-
interrupt
public void interrupt()Description copied from class:DB
Aborts any pending operation and returns at its earliest opportunity. -
busy_timeout
public void busy_timeout(int ms) Description copied from class:DB
Sets a busy handler that sleeps for a specified amount of time when a table is locked.- Specified by:
busy_timeout
in classDB
- Parameters:
ms
- Time to sleep in milliseconds.- See Also:
-
busy_handler
Description copied from class:DB
Sets a busy handler that sleeps for a specified amount of time when a table is locked.- Specified by:
busy_handler
in classDB
- Parameters:
busyHandler
-- See Also:
-
prepare
Description copied from class:DB
Complies an SQL statement.- Specified by:
prepare
in classDB
- Parameters:
sql
- An SQL statement.- Returns:
- Result Codes
- Throws:
SQLException
- See Also:
-
prepare_utf8
- Throws:
SQLException
-
errmsg
String errmsg()Description copied from class:DB
Return English-language text that describes the error as either UTF-8 or UTF-16. -
errmsg_utf8
ByteBuffer errmsg_utf8() -
libversion
Description copied from class:DB
Returns the value for SQLITE_VERSION, SQLITE_VERSION_NUMBER, and SQLITE_SOURCE_ID C preprocessor macros that are associated with the library.- Specified by:
libversion
in classDB
- Returns:
- Compile-time SQLite version information.
- See Also:
-
libversion_utf8
ByteBuffer libversion_utf8() -
changes
public long changes() -
total_changes
public long total_changes()- Specified by:
total_changes
in classDB
- Returns:
- Number of row changes caused by INSERT, UPDATE or DELETE statements since the database connection was opened.
- See Also:
-
finalize
protected int finalize(long stmt) Description copied from class:DB
Destroys a prepared statement.- Specified by:
finalize
in classDB
- Parameters:
stmt
- Pointer to the statement pointer.- Returns:
- Result Codes
- See Also:
-
step
public int step(long stmt) Description copied from class:DB
Evaluates a statement.- Specified by:
step
in classDB
- Parameters:
stmt
- Pointer to the statement.- Returns:
- Result Codes
- See Also:
-
reset
public int reset(long stmt) Description copied from class:DB
Sets a prepared statement object back to its initial state, ready to be re-executed.- Specified by:
reset
in classDB
- Parameters:
stmt
- Pointer to the statement.- Returns:
- Result Codes
- See Also:
-
clear_bindings
public int clear_bindings(long stmt) Description copied from class:DB
Reset all bindings on a prepared statement (reset all host parameters to NULL).- Specified by:
clear_bindings
in classDB
- Parameters:
stmt
- Pointer to the statement.- Returns:
- Result Codes
- See Also:
-
bind_parameter_count
int bind_parameter_count(long stmt) - Specified by:
bind_parameter_count
in classDB
- Parameters:
stmt
- Pointer to the statement.- Returns:
- Number of parameters in a prepared SQL.
- See Also:
-
column_count
public int column_count(long stmt) - Specified by:
column_count
in classDB
- Parameters:
stmt
- Pointer to the statement.- Returns:
- Number of columns in the result set returned by the prepared statement.
- See Also:
-
column_type
public int column_type(long stmt, int col) - Specified by:
column_type
in classDB
- Parameters:
stmt
- Pointer to the statement.col
- Number of column.- Returns:
- Datatype code for the initial data type of the result column.
- See Also:
-
column_decltype
- Specified by:
column_decltype
in classDB
- Parameters:
stmt
- Pointer to the statement.col
- Number of column.- Returns:
- Declared type of the table column for prepared statement.
- See Also:
-
column_decltype_utf8
-
column_table_name
- Specified by:
column_table_name
in classDB
- Parameters:
stmt
- Pointer to the statement.col
- Number of column.- Returns:
- Original text of column name which is the declared in the CREATE TABLE statement.
- See Also:
-
column_table_name_utf8
-
column_name
- Specified by:
column_name
in classDB
- Parameters:
stmt
- Pointer to the statement.col
- The number of column.- Returns:
- Name assigned to a particular column in the result set of a SELECT statement.
- See Also:
-
column_name_utf8
-
column_text
- Specified by:
column_text
in classDB
- Parameters:
stmt
- 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.
- See Also:
-
column_text_utf8
-
column_blob
public byte[] column_blob(long stmt, int col) - Specified by:
column_blob
in classDB
- Parameters:
stmt
- Pointer to the statement.col
- Number of column.- Returns:
- BLOB value of the column in the result set of a SELECT statement
- See Also:
-
column_double
public double column_double(long stmt, int col) - Specified by:
column_double
in classDB
- Parameters:
stmt
- Pointer to the statement.col
- Number of column.- Returns:
- DOUBLE value of the column in the result set of a SELECT statement
- See Also:
-
column_long
public long column_long(long stmt, int col) - Specified by:
column_long
in classDB
- Parameters:
stmt
- Pointer to the statement.col
- Number of column.- Returns:
- LONG value of the column in the result set of a SELECT statement.
- See Also:
-
column_int
public int column_int(long stmt, int col) - Specified by:
column_int
in classDB
- Parameters:
stmt
- Pointer to the statement.col
- Number of column.- Returns:
- INT value of column in the result set of a SELECT statement.
- See Also:
-
bind_null
int bind_null(long stmt, int pos) Description copied from class:DB
Binds NULL value to prepared statements with the pointer to the statement object and the index of the SQL parameter to be set to NULL.- Specified by:
bind_null
in classDB
- Parameters:
stmt
- Pointer to the statement.pos
- The index of the SQL parameter to be set to NULL.- Returns:
- Result Codes
- See Also:
-
bind_int
int bind_int(long stmt, int pos, int v) Description copied from class:DB
Binds int value to prepared statements with the pointer to the statement object, the index of the SQL parameter to be set and the value to bind to the parameter.- Specified by:
bind_int
in classDB
- Parameters:
stmt
- Pointer to the statement.pos
- The index of the SQL parameter to be set.v
- Value to bind to the parameter.- Returns:
- Result Codes
- See Also:
-
bind_long
int bind_long(long stmt, int pos, long v) Description copied from class:DB
Binds long value to prepared statements with the pointer to the statement object, the index of the SQL parameter to be set and the value to bind to the parameter.- Specified by:
bind_long
in classDB
- Parameters:
stmt
- Pointer to the statement.pos
- The index of the SQL parameter to be set.v
- Value to bind to the parameter.- Returns:
- Result Codes
- See Also:
-
bind_double
int bind_double(long stmt, int pos, double v) Description copied from class:DB
Binds double value to prepared statements with the pointer to the statement object, the index of the SQL parameter to be set and the value to bind to the parameter.- Specified by:
bind_double
in classDB
- Parameters:
stmt
- Pointer to the statement.pos
- Index of the SQL parameter to be set.v
- Value to bind to the parameter.- Returns:
- Result Codes
- See Also:
-
bind_text
Description copied from class:DB
Binds text value to prepared statements with the pointer to the statement object, the index of the SQL parameter to be set and the value to bind to the parameter.- Specified by:
bind_text
in classDB
- Parameters:
stmt
- Pointer to the statement.pos
- Index of the SQL parameter to be set.v
- value to bind to the parameter.- Returns:
- Result Codes
- See Also:
-
bind_text_utf8
int bind_text_utf8(long stmt, int pos, byte[] vUtf8) -
bind_blob
int bind_blob(long stmt, int pos, byte[] v) Description copied from class:DB
Binds blob value to prepared statements with the pointer to the statement object, the index of the SQL parameter to be set and the value to bind to the parameter.- Specified by:
bind_blob
in classDB
- Parameters:
stmt
- Pointer to the statement.pos
- Index of the SQL parameter to be set.v
- Value to bind to the parameter.- Returns:
- Result Codes
- See Also:
-
result_null
public void result_null(long context) Description copied from class:DB
Sets the result of an SQL function as NULL with the pointer to the SQLite database context.- Specified by:
result_null
in classDB
- Parameters:
context
- Pointer to the SQLite database context.- See Also:
-
result_text
Description copied from class:DB
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.- Specified by:
result_text
in classDB
- Parameters:
context
- Pointer to the SQLite database context.val
- Result value of an SQL function.- See Also:
-
result_text_utf8
void result_text_utf8(long context, byte[] valUtf8) -
result_blob
public void result_blob(long context, byte[] val) Description copied from class:DB
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.- Specified by:
result_blob
in classDB
- Parameters:
context
- Pointer to the SQLite database context.val
- Result value of an SQL function.- See Also:
-
result_double
public void result_double(long context, double val) Description copied from class:DB
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.- Specified by:
result_double
in classDB
- Parameters:
context
- Pointer to the SQLite database context.val
- Result value of an SQL function.- See Also:
-
result_long
public void result_long(long context, long val) Description copied from class:DB
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.- Specified by:
result_long
in classDB
- Parameters:
context
- Pointer to the SQLite database context.val
- Result value of an SQL function.- See Also:
-
result_int
public void result_int(long context, int val) Description copied from class:DB
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.- Specified by:
result_int
in classDB
- Parameters:
context
- Pointer to the SQLite database context.val
- Result value of an SQL function.- See Also:
-
result_error
Description copied from class:DB
Sets 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_error
in classDB
- Parameters:
context
- Pointer to the SQLite database context.err
- Error result of an SQL function.- See Also:
-
result_error_utf8
void result_error_utf8(long context, byte[] errUtf8) -
value_text
- Specified by:
value_text
in 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.
- See Also:
-
value_text_utf8
-
value_blob
- Specified by:
value_blob
in 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.
- See Also:
-
value_double
- Specified by:
value_double
in 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
- See Also:
-
value_long
- Specified by:
value_long
in 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.
- See Also:
-
value_int
Description copied from class:DB
Accesses the parameter values on the function or aggregate in int data type with the function object and the parameter value. -
value_type
- Specified by:
value_type
in 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.
- See Also:
-
create_function
Description copied from class:DB
Create a user defined function with given function name and the function object.- Specified by:
create_function
in classDB
- Parameters:
name
- The function name to be created.func
- SQLite function object.flags
- Extra flags to use when creating the function, such asFunction.FLAG_DETERMINISTIC
- Returns:
- Result Codes
- Throws:
SQLException
- See Also:
-
create_function_utf8
-
destroy_function
Description copied from class:DB
De-registers a user defined function- Specified by:
destroy_function
in classDB
- Parameters:
name
- Name of the function to de-registered.- Returns:
- Result Codes
- Throws:
SQLException
- See Also:
-
destroy_function_utf8
int destroy_function_utf8(byte[] nameUtf8) -
create_collation
Description copied from class:DB
Create a user defined collation with given collation name and the collation object.- Specified by:
create_collation
in classDB
- Parameters:
name
- The collation name to be created.coll
- SQLite collation object.- Returns:
- Result Codes
- Throws:
SQLException
- See Also:
-
create_collation_utf8
-
destroy_collation
Description copied from class:DB
Create a user defined collation with given collation name and the collation object.- Specified by:
destroy_collation
in classDB
- Parameters:
name
- The collation name to be created.- Returns:
- Result Codes
- Throws:
SQLException
- See Also:
-
destroy_collation_utf8
int destroy_collation_utf8(byte[] nameUtf8) -
limit
- Specified by:
limit
in 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:
-
nameToUtf8ByteArray
- Throws:
SQLException
-
backup
public int backup(String dbName, String destFileName, DB.ProgressObserver observer) throws SQLException - Specified by:
backup
in classDB
- Parameters:
dbName
- Database name to be backed up.destFileName
- Target backup file name.observer
- ProgressObserver object.- Returns:
- Result Codes
- Throws:
SQLException
- See Also:
-
backup
public int backup(String dbName, String destFileName, DB.ProgressObserver observer, int sleepTimeMillis, int nTimeouts, int pagesPerStep) throws SQLException - Specified by:
backup
in 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 continuingnTimeouts
- 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
- See Also:
-
backup
int backup(byte[] dbNameUtf8, byte[] destFileNameUtf8, DB.ProgressObserver observer, int sleepTimeMillis, int nTimeouts, int pagesPerStep) throws SQLException - Throws:
SQLException
-
restore
public int restore(String dbName, String sourceFileName, DB.ProgressObserver observer) throws SQLException - Specified by:
restore
in classDB
- Parameters:
dbName
- Database name for restoring data.sourceFileName
- Source file name.observer
- ProgressObserver object.- Returns:
- Result Codes
- Throws:
SQLException
- See Also:
-
restore
public int restore(String dbName, String sourceFileName, DB.ProgressObserver observer, int sleepTimeMillis, int nTimeouts, int pagesPerStep) throws SQLException - Specified by:
restore
in 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 continuingnTimeouts
- 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
- See Also:
-
restore
int restore(byte[] dbNameUtf8, byte[] sourceFileName, DB.ProgressObserver observer, int sleepTimeMillis, int nTimeouts, int pagesPerStep) throws SQLException - Throws:
SQLException
-
column_metadata
boolean[][] column_metadata(long stmt) Provides metadata for table columns.- Specified by:
column_metadata
in classDB
- Parameters:
stmt
- Pointer to the statement.- Returns:
- Column attribute array.
index[col][0] = true if column constrained NOT NULL;
index[col][1] = true if column is part of the primary key;
index[col][2] = true if column is auto-increment. - See Also:
-
set_commit_listener
void set_commit_listener(boolean enabled) - Specified by:
set_commit_listener
in classDB
-
set_update_listener
void set_update_listener(boolean enabled) - Specified by:
set_update_listener
in classDB
-
throwex
Throws an SQLException. Called from native code- Parameters:
msg
- Message for the SQLException.- Throws:
SQLException
- the generated SQLException
-
stringToUtf8ByteArray
-
utf8ByteBufferToString
-
register_progress_handler
public void register_progress_handler(int vmCalls, ProgressHandler progressHandler) throws SQLException Description copied from class:DB
Progress handler- Specified by:
register_progress_handler
in classDB
- Throws:
SQLException
-
clear_progress_handler
- Specified by:
clear_progress_handler
in classDB
- Throws:
SQLException
-
getBusyHandler
long getBusyHandler()Getter for native pointer to validate memory is properly cleaned up in unit tests- Returns:
- a native pointer to validate memory is properly cleaned up in unit tests
-
getCommitListener
long getCommitListener()Getter for native pointer to validate memory is properly cleaned up in unit tests- Returns:
- a native pointer to validate memory is properly cleaned up in unit tests
-
getUpdateListener
long getUpdateListener()Getter for native pointer to validate memory is properly cleaned up in unit tests- Returns:
- a native pointer to validate memory is properly cleaned up in unit tests
-
getProgressHandler
long getProgressHandler()Getter for native pointer to validate memory is properly cleaned up in unit tests- Returns:
- a native pointer to validate memory is properly cleaned up in unit tests
-
serialize
- Specified by:
serialize
in classDB
- Throws:
SQLException
-
deserialize
- Specified by:
deserialize
in classDB
- Throws:
SQLException
-