Class NativeDB

  • All Implemented Interfaces:
    Codes

    public final class NativeDB
    extends DB
    This class provides a thin JNI layer over the SQLite3 C API.
    • Constructor Summary

      Constructors 
      Constructor Description
      NativeDB()  
    • 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​(java.lang.String sql)
      Complies, evaluates, executes and commits an SQL statement.
      (package private) int _exec_utf8​(byte[] sqlUtf8)  
      protected void _open​(java.lang.String file, int openFlags)
      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 backup​(java.lang.String dbName, java.lang.String destFileName, DB.ProgressObserver observer)  
      (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 bind_text​(long stmt, int pos, java.lang.String v)
      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.
      int changes()  
      int clear_bindings​(long stmt)
      Reset all bindings on a prepared statement (reset all host parameters to NULL).
      void clear_progress_handler()  
      byte[] column_blob​(long stmt, int col)  
      int column_count​(long stmt)  
      java.lang.String column_decltype​(long stmt, int col)  
      (package private) byte[] 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.
      java.lang.String column_name​(long stmt, int col)  
      (package private) byte[] column_name_utf8​(long stmt, int col)  
      java.lang.String column_table_name​(long stmt, int col)  
      (package private) byte[] column_table_name_utf8​(long stmt, int col)  
      java.lang.String column_text​(long stmt, int col)  
      (package private) byte[] column_text_utf8​(long stmt, int col)  
      int column_type​(long stmt, int col)  
      int create_function​(java.lang.String name, Function func)
      Create a user defined function with given function name and the function object.
      (package private) int create_function_utf8​(byte[] nameUtf8, Function func)  
      int destroy_function​(java.lang.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) java.lang.String errmsg()
      Return English-language text that describes the error as either UTF-8 or UTF-16.
      (package private) byte[] errmsg_utf8()  
      protected int finalize​(long stmt)
      Destroys a prepared statement.
      (package private) void free_functions()
      Unused as we use the user_data pointer to store a single word.
      void interrupt()
      Aborts any pending operation and returns at its earliest opportunity.
      java.lang.String libversion()
      Returns the value for SQLITE_VERSION, SQLITE_VERSION_NUMBER, and SQLITE_SOURCE_ID C preprocessor macros that are associated with the library.
      (package private) byte[] libversion_utf8()  
      static boolean load()
      Loads the SQLite interface backend.
      protected long prepare​(java.lang.String sql)
      Complies an SQL statement.
      (package private) long prepare_utf8​(byte[] sqlUtf8)  
      void register_progress_handler​(int vmCalls, ProgressHandler progressHandler)
      Progress handler
      int 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 restore​(java.lang.String dbName, java.lang.String sourceFileName, DB.ProgressObserver observer)  
      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, java.lang.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, java.lang.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)  
      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[] stringToUtf8ByteArray​(java.lang.String str)  
      (package private) static void throwex​(java.lang.String msg)
      Throws an SQLException
      int total_changes()  
      (package private) static java.lang.String utf8ByteArrayToString​(byte[] utf8bytes)  
      byte[] value_blob​(Function f, int arg)  
      double value_double​(Function f, int arg)  
      int value_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.
      long value_long​(Function f, int arg)  
      java.lang.String value_text​(Function f, int arg)  
      (package private) byte[] value_text_utf8​(Function f, int argUtf8)  
      int value_type​(Function f, int arg)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • pointer

        long pointer
        SQLite connection handle.
      • isLoaded

        private static boolean isLoaded
      • loadSucceeded

        private static boolean loadSucceeded
      • udfdatalist

        private final long udfdatalist
        linked list of all instanced UDFDatas
        See Also:
        Constant Field Values
    • Constructor Detail

      • NativeDB

        public NativeDB()
    • Method Detail

      • load

        public static boolean load()
                            throws java.lang.Exception
        Loads the SQLite interface backend.
        Returns:
        True if the SQLite JDBC driver is successfully loaded; false otherwise.
        Throws:
        java.lang.Exception
      • _open

        protected void _open​(java.lang.String file,
                             int openFlags)
                      throws java.sql.SQLException
        Description copied from class: DB
        Creates an SQLite interface to a database with the provided open flags.
        Specified by:
        _open in class DB
        Parameters:
        file - The database to open.
        openFlags - File opening configurations (http://www.sqlite.org/c3ref/c_open_autoproxy.html)
        Throws:
        java.sql.SQLException
        See Also:
        DB._open(java.lang.String, int)
      • _open_utf8

        void _open_utf8​(byte[] fileUtf8,
                        int openFlags)
                 throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • _close

        protected void _close()
                       throws java.sql.SQLException
        Description copied from class: DB
        Closes the SQLite interface to a database.
        Specified by:
        _close in class DB
        Throws:
        java.sql.SQLException
        See Also:
        DB._close()
      • _exec

        public int _exec​(java.lang.String sql)
                  throws java.sql.SQLException
        Description copied from class: DB
        Complies, evaluates, executes and commits an SQL statement.
        Specified by:
        _exec in class DB
        Parameters:
        sql - An SQL statement.
        Returns:
        Result Codes
        Throws:
        java.sql.SQLException
        See Also:
        DB._exec(java.lang.String)
      • _exec_utf8

        int _exec_utf8​(byte[] sqlUtf8)
                throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • shared_cache

        public int shared_cache​(boolean enable)
        Description copied from class: DB
        Enables or disables the sharing of the database cache and schema data structures between connections to the same database.
        Specified by:
        shared_cache in class DB
        Parameters:
        enable - True to enable; false otherwise.
        Returns:
        Result Codes
        See Also:
        DB.shared_cache(boolean)
      • interrupt

        public void interrupt()
        Description copied from class: DB
        Aborts any pending operation and returns at its earliest opportunity.
        Specified by:
        interrupt in class DB
        See Also:
        DB.interrupt()
      • 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 class DB
        Parameters:
        ms - Time to sleep in milliseconds.
        See Also:
        DB.busy_timeout(int)
      • busy_handler

        public void busy_handler​(BusyHandler busyHandler)
        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 class DB
        See Also:
        org.sqlite.core.DB#busy_handler(int)
      • prepare

        protected long prepare​(java.lang.String sql)
                        throws java.sql.SQLException
        Description copied from class: DB
        Complies an SQL statement.
        Specified by:
        prepare in class DB
        Parameters:
        sql - An SQL statement.
        Returns:
        Result Codes
        Throws:
        java.sql.SQLException
        See Also:
        DB.prepare(java.lang.String)
      • prepare_utf8

        long prepare_utf8​(byte[] sqlUtf8)
                   throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • errmsg

        java.lang.String errmsg()
        Description copied from class: DB
        Return English-language text that describes the error as either UTF-8 or UTF-16.
        Specified by:
        errmsg in class DB
        Returns:
        Error description in English.
        See Also:
        DB.errmsg()
      • errmsg_utf8

        byte[] errmsg_utf8()
      • libversion

        public java.lang.String 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 class DB
        Returns:
        Compile-time SQLite version information.
        See Also:
        DB.libversion()
      • libversion_utf8

        byte[] libversion_utf8()
      • changes

        public int changes()
        Specified by:
        changes in class DB
        Returns:
        Number of rows that were changed, inserted or deleted by the last SQL statement
        See Also:
        DB.changes()
      • total_changes

        public int total_changes()
        Specified by:
        total_changes in class DB
        Returns:
        Number of row changes caused by INSERT, UPDATE or DELETE statements since the database connection was opened.
        See Also:
        DB.total_changes()
      • finalize

        protected int finalize​(long stmt)
        Description copied from class: DB
        Destroys a prepared statement.
        Specified by:
        finalize in class DB
        Parameters:
        stmt - Pointer to the statement pointer.
        Returns:
        Result Codes
        See Also:
        DB.finalize(long)
      • step

        public int step​(long stmt)
        Description copied from class: DB
        Evaluates a statement.
        Specified by:
        step in class DB
        Parameters:
        stmt - Pointer to the statement.
        Returns:
        Result Codes
        See Also:
        DB.step(long)
      • 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 class DB
        Parameters:
        stmt - Pointer to the statement.
        Returns:
        Result Codes
        See Also:
        DB.reset(long)
      • 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 class DB
        Parameters:
        stmt - Pointer to the statement.
        Returns:
        Result Codes
        See Also:
        DB.clear_bindings(long)
      • column_count

        public int column_count​(long stmt)
        Specified by:
        column_count in class DB
        Parameters:
        stmt - Pointer to the statement.
        Returns:
        Number of columns in the result set returned by the prepared statement.
        See Also:
        DB.column_count(long)
      • column_type

        public int column_type​(long stmt,
                               int col)
        Specified by:
        column_type in class DB
        Parameters:
        stmt - Pointer to the statement.
        col - Number of column.
        Returns:
        Datatype code for the initial data type of the result column.
        See Also:
        DB.column_type(long, int)
      • column_decltype

        public java.lang.String column_decltype​(long stmt,
                                                int col)
        Specified by:
        column_decltype in class DB
        Parameters:
        stmt - Pointer to the statement.
        col - Number of column.
        Returns:
        Declared type of the table column for prepared statement.
        See Also:
        DB.column_decltype(long, int)
      • column_decltype_utf8

        byte[] column_decltype_utf8​(long stmt,
                                    int col)
      • column_table_name

        public java.lang.String column_table_name​(long stmt,
                                                  int col)
        Specified by:
        column_table_name in class DB
        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:
        DB.column_table_name(long, int)
      • column_table_name_utf8

        byte[] column_table_name_utf8​(long stmt,
                                      int col)
      • column_name

        public java.lang.String column_name​(long stmt,
                                            int col)
        Specified by:
        column_name in class DB
        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:
        DB.column_name(long, int)
      • column_name_utf8

        byte[] column_name_utf8​(long stmt,
                                int col)
      • column_text

        public java.lang.String column_text​(long stmt,
                                            int col)
        Specified by:
        column_text in class DB
        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:
        DB.column_text(long, int)
      • column_text_utf8

        byte[] column_text_utf8​(long stmt,
                                int col)
      • column_blob

        public byte[] column_blob​(long stmt,
                                  int col)
        Specified by:
        column_blob in class DB
        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:
        DB.column_blob(long, int)
      • column_double

        public double column_double​(long stmt,
                                    int col)
        Specified by:
        column_double in class DB
        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:
        DB.column_double(long, int)
      • column_long

        public long column_long​(long stmt,
                                int col)
        Specified by:
        column_long in class DB
        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:
        DB.column_long(long, int)
      • column_int

        public int column_int​(long stmt,
                              int col)
        Specified by:
        column_int in class DB
        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:
        DB.column_int(long, int)
      • 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 class DB
        Parameters:
        stmt - Pointer to the statement.
        pos - The index of the SQL parameter to be set to NULL.
        Returns:
        Result Codes
        See Also:
        DB.bind_null(long, int)
      • 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 class DB
        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:
        DB.bind_int(long, int, int)
      • 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 class DB
        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:
        DB.bind_long(long, int, long)
      • 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 class DB
        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:
        DB.bind_double(long, int, double)
      • bind_text

        int bind_text​(long stmt,
                      int pos,
                      java.lang.String v)
        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 class DB
        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:
        DB.bind_text(long, int, java.lang.String)
      • 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 class DB
        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:
        DB.bind_blob(long, int, byte[])
      • 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 class DB
        Parameters:
        context - Pointer to the SQLite database context.
        See Also:
        DB.result_null(long)
      • result_text

        public void result_text​(long context,
                                java.lang.String val)
        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 class DB
        Parameters:
        context - Pointer to the SQLite database context.
        val - Result value of an SQL function.
        See Also:
        DB.result_text(long, java.lang.String)
      • 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 class DB
        Parameters:
        context - Pointer to the SQLite database context.
        val - Result value of an SQL function.
        See Also:
        DB.result_blob(long, byte[])
      • 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 class DB
        Parameters:
        context - Pointer to the SQLite database context.
        val - Result value of an SQL function.
        See Also:
        DB.result_double(long, double)
      • 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 class DB
        Parameters:
        context - Pointer to the SQLite database context.
        val - Result value of an SQL function.
        See Also:
        DB.result_long(long, long)
      • 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 class DB
        Parameters:
        context - Pointer to the SQLite database context.
        val - Result value of an SQL function.
        See Also:
        DB.result_int(long, int)
      • result_error

        public void result_error​(long context,
                                 java.lang.String err)
        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 class DB
        Parameters:
        context - Pointer to the SQLite database context.
        err - Error result of an SQL function.
        See Also:
        DB.result_error(long, java.lang.String)
      • result_error_utf8

        void result_error_utf8​(long context,
                               byte[] errUtf8)
      • value_text

        public java.lang.String value_text​(Function f,
                                           int arg)
        Specified by:
        value_text in class DB
        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:
        DB.value_text(org.sqlite.Function, int)
      • value_text_utf8

        byte[] value_text_utf8​(Function f,
                               int argUtf8)
      • value_blob

        public byte[] value_blob​(Function f,
                                 int arg)
        Specified by:
        value_blob in class DB
        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:
        DB.value_blob(org.sqlite.Function, int)
      • value_double

        public double value_double​(Function f,
                                   int arg)
        Specified by:
        value_double in class DB
        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:
        DB.value_double(org.sqlite.Function, int)
      • value_long

        public long value_long​(Function f,
                               int arg)
        Specified by:
        value_long in class DB
        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:
        DB.value_long(org.sqlite.Function, int)
      • value_int

        public int value_int​(Function f,
                             int arg)
        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.
        Specified by:
        value_int in class DB
        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.
        See Also:
        DB.value_int(org.sqlite.Function, int)
      • value_type

        public int value_type​(Function f,
                              int arg)
        Specified by:
        value_type in class DB
        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:
        DB.value_type(org.sqlite.Function, int)
      • create_function_utf8

        int create_function_utf8​(byte[] nameUtf8,
                                 Function func)
      • destroy_function_utf8

        int destroy_function_utf8​(byte[] nameUtf8)
      • free_functions

        void free_functions()
        Description copied from class: DB
        Unused as we use the user_data pointer to store a single word.
        Specified by:
        free_functions in class DB
        See Also:
        DB.free_functions()
      • backup

        int backup​(byte[] dbNameUtf8,
                   byte[] destFileNameUtf8,
                   DB.ProgressObserver observer)
            throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • restore

        int restore​(byte[] dbNameUtf8,
                    byte[] sourceFileName,
                    DB.ProgressObserver observer)
             throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • column_metadata

        boolean[][] column_metadata​(long stmt)
        Provides metadata for table columns.
        Specified by:
        column_metadata in class DB
        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:
        DB.column_metadata(long)
      • throwex

        static void throwex​(java.lang.String msg)
                     throws java.sql.SQLException
        Throws an SQLException
        Parameters:
        msg - Message for the SQLException.
        Throws:
        java.sql.SQLException
      • stringToUtf8ByteArray

        static byte[] stringToUtf8ByteArray​(java.lang.String str)
      • utf8ByteArrayToString

        static java.lang.String utf8ByteArrayToString​(byte[] utf8bytes)
      • register_progress_handler

        public void register_progress_handler​(int vmCalls,
                                              ProgressHandler progressHandler)
                                       throws java.sql.SQLException
        Description copied from class: DB
        Progress handler
        Specified by:
        register_progress_handler in class DB
        Throws:
        java.sql.SQLException
      • clear_progress_handler

        public void clear_progress_handler()
                                    throws java.sql.SQLException
        Specified by:
        clear_progress_handler in class DB
        Throws:
        java.sql.SQLException