Class SQLiteAdapter

    • Field Detail

      • MAX_IDENTIFIER_LENGTH

        protected static final int MAX_IDENTIFIER_LENGTH
        See Also:
        Constant Field Values
    • Constructor Detail

      • SQLiteAdapter

        public SQLiteAdapter​(java.sql.DatabaseMetaData metadata)
        Constructor.
        Parameters:
        metadata - MetaData for the Database
    • Method Detail

      • initialiseTypes

        public void initialiseTypes​(org.datanucleus.store.schema.StoreSchemaHandler handler,
                                    org.datanucleus.store.connection.ManagedConnection mconn)
        Description copied from class: BaseDatastoreAdapter
        Initialise the types for this datastore.
        Specified by:
        initialiseTypes in interface DatastoreAdapter
        Overrides:
        initialiseTypes in class BaseDatastoreAdapter
        Parameters:
        handler - SchemaHandler that we initialise the types for
        mconn - Managed connection to use
      • getCreateDatabaseStatement

        public java.lang.String getCreateDatabaseStatement​(java.lang.String catalogName,
                                                           java.lang.String schemaName)
        Description copied from interface: DatastoreAdapter
        Method to return the statement necessary to create a database with this RDBMS. Note that some RDBMS don't support this.
        Specified by:
        getCreateDatabaseStatement in interface DatastoreAdapter
        Overrides:
        getCreateDatabaseStatement in class BaseDatastoreAdapter
        Parameters:
        catalogName - name of the catalog
        schemaName - Name of the schema
        Returns:
        The DDL statement
      • getDropDatabaseStatement

        public java.lang.String getDropDatabaseStatement​(java.lang.String catalogName,
                                                         java.lang.String schemaName)
        Description copied from interface: DatastoreAdapter
        Method to return the statement necessary to drop a database with this RDBMS. Note that some RDBMS don't support this.
        Specified by:
        getDropDatabaseStatement in interface DatastoreAdapter
        Overrides:
        getDropDatabaseStatement in class BaseDatastoreAdapter
        Parameters:
        catalogName - Name of the catalog
        schemaName - Name of the schema
        Returns:
        The DDL statement
      • getUpdateTableStatement

        public SQLText getUpdateTableStatement​(SQLTable tbl,
                                               SQLText setSQL)
        Method to return the SQLText for an UPDATE TABLE statement. Returns the SQLText for UPDATE SCH1.TBL1 SET x1 = val1, x2 = val2 since SQLite doesn't allow any aliases in UPDATEs.
        Specified by:
        getUpdateTableStatement in interface DatastoreAdapter
        Overrides:
        getUpdateTableStatement in class BaseDatastoreAdapter
        Parameters:
        tbl - The primary table
        setSQL - The SQLText for the SET component
        Returns:
        SQLText for the update statement
      • getDeleteTableStatement

        public java.lang.String getDeleteTableStatement​(SQLTable tbl)
        Method to return the basic SQL for a DELETE TABLE statement. Returns the String as DELETE FROM SCH1.TBL1 since SQLite doesn't allow any aliases in DELETEs.
        Specified by:
        getDeleteTableStatement in interface DatastoreAdapter
        Overrides:
        getDeleteTableStatement in class BaseDatastoreAdapter
        Parameters:
        tbl - The SQLTable to delete
        Returns:
        The delete table string
      • getRangeByLimitEndOfStatementClause

        public java.lang.String getRangeByLimitEndOfStatementClause​(long offset,
                                                                    long count,
                                                                    boolean hasOrdering)
        Method to return the SQL to append to the WHERE clause of a SELECT statement to handle restriction of ranges using the LIMIT keyword.
        Specified by:
        getRangeByLimitEndOfStatementClause in interface DatastoreAdapter
        Overrides:
        getRangeByLimitEndOfStatementClause in class BaseDatastoreAdapter
        Parameters:
        offset - The offset to return from
        count - The number of items to return
        hasOrdering - Whether ordering is present
        Returns:
        The SQL to append to allow for ranges using LIMIT.
      • getIdentityLastValueStmt

        public java.lang.String getIdentityLastValueStmt​(Table table,
                                                         java.lang.String columnName)
        Description copied from class: BaseDatastoreAdapter
        Accessor for the autoincrementing sql statement for this datastore.
        Specified by:
        getIdentityLastValueStmt in interface DatastoreAdapter
        Overrides:
        getIdentityLastValueStmt in class BaseDatastoreAdapter
        Parameters:
        table - Name of the table that the autoincrement is for
        columnName - Name of the column that the autoincrement is for
        Returns:
        The statement for getting the latest autoincremented key
      • getIdentityKeyword

        public java.lang.String getIdentityKeyword​(org.datanucleus.store.StoreManager storeMgr)
        Description copied from class: BaseDatastoreAdapter
        Accessor for the autoincrementing keyword for generating DDLs (CREATE TABLEs...).
        Specified by:
        getIdentityKeyword in interface DatastoreAdapter
        Overrides:
        getIdentityKeyword in class BaseDatastoreAdapter
        Parameters:
        storeMgr - The Store Manager
        Returns:
        The keyword for a column using autoincrement
      • getSQLMethodClass

        public java.lang.Class<? extends SQLMethod> getSQLMethodClass​(java.lang.String className,
                                                                      java.lang.String methodName,
                                                                      org.datanucleus.ClassLoaderResolver clr)
        Description copied from interface: DatastoreAdapter
        Accessor for the SQLMethod class for the query invocation of specified class + method name (if available for this datastore).
        Specified by:
        getSQLMethodClass in interface DatastoreAdapter
        Overrides:
        getSQLMethodClass in class BaseDatastoreAdapter
        Parameters:
        className - Name of the class (or null if this is a STATIC method)
        methodName - Method name
        clr - ClassLoader resolver, in case className is a subclass of a supported type
        Returns:
        The SQLMethod class (or null if not defined for this datastore).
      • loadColumnMappings

        protected void loadColumnMappings​(org.datanucleus.plugin.PluginManager mgr,
                                          org.datanucleus.ClassLoaderResolver clr)
        Load all datastore mappings for this RDBMS database.
        Overrides:
        loadColumnMappings in class BaseDatastoreAdapter
        Parameters:
        mgr - the PluginManager
        clr - the ClassLoaderResolver