Class InformixAdapter

  • All Implemented Interfaces:
    DatastoreAdapter

    public class InformixAdapter
    extends BaseDatastoreAdapter
    Provides methods for adapting SQL language elements to the Informix database. Overrides some methods in DatabaseAdapter where Informix behaviour differs. Informix databases must be created WITH LOG MODE ANSI, otherwise errors like "Transaction Not Supported", "Not in transaction" will appear. See the informix info.
    • Constructor Detail

      • InformixAdapter

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

      • newSQLTypeInfo

        public SQLTypeInfo newSQLTypeInfo​(java.sql.ResultSet rs)
        Description copied from interface: DatastoreAdapter
        Create a new SQL type info from the current row of the passed ResultSet. Allows an adapter to override particular types where the JDBC driver is known to be buggy.
        Specified by:
        newSQLTypeInfo in interface DatastoreAdapter
        Overrides:
        newSQLTypeInfo in class BaseDatastoreAdapter
        Parameters:
        rs - ResultSet
        Returns:
        The SQL type info
      • getIdentityLastValueStmt

        public java.lang.String getIdentityLastValueStmt​(Table table,
                                                         java.lang.String columnName)
        Accessor for the autoincrement sql access 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 auto-increment key
      • 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 - Store Manager
        Returns:
        The keyword for a column using auto-increment
      • getAddForeignKeyStatement

        public java.lang.String getAddForeignKeyStatement​(ForeignKey fk,
                                                          IdentifierFactory factory)
        Returns the appropriate SQL to add a foreign key to its table. It should return something like:
         ALTER TABLE FOO ADD CONSTRAINT FOREIGN KEY (BAR, BAZ) REFERENCES ABC (COL1, COL2) CONSTRAINT FOO_FK1
         ALTER TABLE FOO ADD FOREIGN KEY (BAR, BAZ) REFERENCES ABC (COL1, COL2)
         
        Specified by:
        getAddForeignKeyStatement in interface DatastoreAdapter
        Overrides:
        getAddForeignKeyStatement in class BaseDatastoreAdapter
        Parameters:
        fk - An object describing the foreign key.
        factory - Identifier factory
        Returns:
        The text of the SQL statement.
      • getAddCandidateKeyStatement

        public java.lang.String getAddCandidateKeyStatement​(CandidateKey ck,
                                                            IdentifierFactory factory)
        Returns the appropriate SQL to add a candidate key to its table. It should return something like:
         ALTER TABLE FOO ADD CONSTRAINT FOO_CK CONSTRAINT UNIQUE (BAZ)
         ALTER TABLE FOO ADD CONSTRAINT UNIQUE (BAZ)
         
        Specified by:
        getAddCandidateKeyStatement in interface DatastoreAdapter
        Overrides:
        getAddCandidateKeyStatement in class BaseDatastoreAdapter
        Parameters:
        ck - An object describing the candidate key.
        factory - Identifier factory
        Returns:
        The text of the SQL statement.
      • getSTRPOSFunction

        private java.lang.String getSTRPOSFunction()
        Creates a NUCLEUS_STRPOS function for Informix
        Returns:
        the SQL NUCLEUS_STRPOS function
      • getSTRPOSDropFunction

        private java.lang.String getSTRPOSDropFunction()
        DROP a NUCLEUS_STRPOS function for Informix
        Returns:
        the SQL NUCLEUS_STRPOS function
      • 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