Class NuoDBAdapter

  • All Implemented Interfaces:
    DatastoreAdapter

    public class NuoDBAdapter
    extends BaseDatastoreAdapter
    Adapter for NuoDB (http://www.nuodb.com). This adapter was written based on v2.0.2 of the NuoDB JDBC driver.
    • Field Detail

      • NONSQL92_RESERVED_WORDS

        public static final java.lang.String NONSQL92_RESERVED_WORDS
        See Also:
        Constant Field Values
      • NUODB_EXTRA_RESERVED_WORDS

        public static final java.lang.String NUODB_EXTRA_RESERVED_WORDS
        See Also:
        Constant Field Values
    • Constructor Detail

      • NuoDBAdapter

        public NuoDBAdapter​(java.sql.DatabaseMetaData metadata)
    • Method Detail

      • getCatalogName

        public java.lang.String getCatalogName​(java.sql.Connection conn)
                                        throws java.sql.SQLException
        Description copied from class: BaseDatastoreAdapter
        Accessor for the Catalog Name for this datastore.
        Specified by:
        getCatalogName in interface DatastoreAdapter
        Overrides:
        getCatalogName in class BaseDatastoreAdapter
        Parameters:
        conn - Connection to the datastore
        Returns:
        The catalog name
        Throws:
        java.sql.SQLException - Thrown if error occurs in determining the catalog name.
      • getSchemaName

        public java.lang.String getSchemaName​(java.sql.Connection conn)
                                       throws java.sql.SQLException
        Description copied from class: BaseDatastoreAdapter
        Accessor for the Schema Name for this datastore.
        Specified by:
        getSchemaName in interface DatastoreAdapter
        Overrides:
        getSchemaName in class BaseDatastoreAdapter
        Parameters:
        conn - Connection to the datastore
        Returns:
        The schema name
        Throws:
        java.sql.SQLException - Thrown if error occurs in determining the schema name.
      • 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
      • getCreateIndexStatement

        public java.lang.String getCreateIndexStatement​(Index idx,
                                                        IdentifierFactory factory)
        Returns the appropriate DDL to create an index. It should return something like:
         CREATE [UNIQUE ]INDEX FOO_N1 ON FOO (BAR,BAZ) [Extended Settings]
         
        Specified by:
        getCreateIndexStatement in interface DatastoreAdapter
        Overrides:
        getCreateIndexStatement in class BaseDatastoreAdapter
        Parameters:
        idx - An object describing the index.
        factory - Identifier factory
        Returns:
        The text of the SQL 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
      • sequenceExists

        public boolean sequenceExists​(java.sql.Connection conn,
                                      java.lang.String catalogName,
                                      java.lang.String schemaName,
                                      java.lang.String seqName)
        Description copied from interface: DatastoreAdapter
        Convenience method to return whether the specified sequence already exists.
        Specified by:
        sequenceExists in interface DatastoreAdapter
        Overrides:
        sequenceExists in class BaseDatastoreAdapter
        Parameters:
        conn - Connection to use for checking
        catalogName - Catalog name
        schemaName - Schema name
        seqName - Name of the sequence
        Returns:
        Whether it exists
      • getSequenceCreateStmt

        public java.lang.String getSequenceCreateStmt​(java.lang.String sequenceName,
                                                      java.lang.Integer min,
                                                      java.lang.Integer max,
                                                      java.lang.Integer start,
                                                      java.lang.Integer increment,
                                                      java.lang.Integer cacheSize)
        Accessor for the sequence statement to create the sequence.
        Specified by:
        getSequenceCreateStmt in interface DatastoreAdapter
        Overrides:
        getSequenceCreateStmt in class BaseDatastoreAdapter
        Parameters:
        sequenceName - Name of the sequence
        min - Minimum value for the sequence
        max - Maximum value for the sequence
        start - Start value for the sequence
        increment - Increment value for the sequence
        cacheSize - Cache size for the sequence
        Returns:
        The statement for getting the next id from the sequence
      • getSequenceNextStmt

        public java.lang.String getSequenceNextStmt​(java.lang.String sequenceName)
        Accessor for the statement for getting the next id from the sequence for this datastore.
        Specified by:
        getSequenceNextStmt in interface DatastoreAdapter
        Overrides:
        getSequenceNextStmt in class BaseDatastoreAdapter
        Parameters:
        sequenceName - Name of the sequence
        Returns:
        The statement for getting the next id for the sequence
      • getIdentityKeyword

        public java.lang.String getIdentityKeyword​(org.datanucleus.store.StoreManager storeMgr)
        Accessor for the auto-increment 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 auto-increment
      • 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 OFFSET/FETCH keywords.
        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 there is ordering present
        Returns:
        The SQL to append to allow for ranges using OFFSET/FETCH.
      • 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