Class DatasourcePlatform

    • Field Detail

      • tableQualifier

        protected String tableQualifier
        Supporting name scopes in database by prefixing the table names with the table qualifier/creator.
      • conversionManager

        protected transient ConversionManager conversionManager
        Allow for conversion to be customized in the platform.
      • timestampQuery

        protected ValueReadQuery timestampQuery
        Store the query use to query the current server time.
      • platformOperators

        protected transient Map platformOperators
        Operators specific to this platform
      • dataTypesConvertedFromAClass

        protected Hashtable dataTypesConvertedFromAClass
        Store the list of Classes that can be converted to from the key.
      • dataTypesConvertedToAClass

        protected Hashtable dataTypesConvertedToAClass
        Store the list of Classes that can be converted from to the key.
      • defaultSequence

        protected Sequence defaultSequence
        Store default sequence
      • sequences

        protected Map<String,​Sequence> sequences
        Store map of sequence names to sequences
      • startDelimiter

        protected String startDelimiter
        Delimiter to use for fields and tables using spaces or other special values
      • endDelimiter

        protected String endDelimiter
      • sequencesLock

        protected Object sequencesLock
        Ensures that only one thread at a time can add/remove sequences
      • defaultNativeSequenceToTable

        protected boolean defaultNativeSequenceToTable
        If the native sequence type is not supported, if table sequencing should be used.
      • defaultSeqenceAtNextValue

        protected boolean defaultSeqenceAtNextValue
        If sequences should start at Next Value
    • Constructor Detail

      • DatasourcePlatform

        public DatasourcePlatform()
    • Method Detail

      • getDefaultNativeSequenceToTable

        public boolean getDefaultNativeSequenceToTable()
        Return if the native sequence type is not supported, if table sequencing should be used.
      • setDefaultNativeSequenceToTable

        public void setDefaultNativeSequenceToTable​(boolean defaultNativeSequenceToTable)
        Set if the native sequence type is not supported, if table sequencing should be used.
      • getDefaultSeqenceAtNextValue

        public boolean getDefaultSeqenceAtNextValue()
        Return if the sequence generation should start at next value.
      • setDefaultSeqenceAtNextValue

        public void setDefaultSeqenceAtNextValue​(boolean defaultSeqenceAtNextValue)
        Set if the sequence generation should start at next value.
      • appendParameter

        public void appendParameter​(Call call,
                                    Writer writer,
                                    Object parameter)
        Add the parameter. Convert the parameter to a string and write it.
        Specified by:
        appendParameter in interface Platform
      • shouldUseCustomModifyForCall

        public boolean shouldUseCustomModifyForCall​(DatabaseField field)
        Used by SQLCall.appendModify(..) If the field should be passed to customModifyInDatabaseCall, retun true, otherwise false. Methods shouldCustomModifyInDatabaseCall and customModifyInDatabaseCall should be kept in sync: shouldCustomModifyInDatabaseCall should return true if and only if the field is handled by customModifyInDatabaseCall.
        Specified by:
        shouldUseCustomModifyForCall in interface Platform
      • sequencesAfterCloneCleanup

        protected void sequencesAfterCloneCleanup()
      • copyInto

        public void copyInto​(Platform platform)
        Copy the state into the new platform.
        Specified by:
        copyInto in interface Platform
      • setConversionManager

        public void setConversionManager​(ConversionManager conversionManager)
        The platform hold its own instance of conversion manager to allow customization.
        Specified by:
        setConversionManager in interface Platform
      • getEndDelimiter

        public String getEndDelimiter()
        Delimiter to use for fields and tables using spaces or other special values. Some databases use different delimiters for the beginning and end of the value. This delimiter indicates the end of the value.
        Specified by:
        getEndDelimiter in interface Platform
      • setEndDelimiter

        public void setEndDelimiter​(String endDelimiter)
        Delimiter to use for fields and tables using spaces or other special values. Some databases use different delimiters for the beginning and end of the value. This delimiter indicates the end of the value.
      • getOperator

        public ExpressionOperator getOperator​(int selector)
        Return the operator for the operator constant defined in ExpressionOperator.
      • getPlatformOperators

        public Map getPlatformOperators()
        Return any platform-specific operators
      • getSelectSequenceQuery

        public ValueReadQuery getSelectSequenceQuery()
        OBSOLETE: This method lazy initializes the select sequence number query. It allows for other queries to be used instead of the default one.
      • getSequencePreallocationSize

        public int getSequencePreallocationSize()
      • getStartDelimiter

        public String getStartDelimiter()
        Delimiter to use for fields and tables using spaces or other special values. Some databases use different delimiters for the beginning and end of the value. This delimiter indicates the start of the value.
        Specified by:
        getStartDelimiter in interface Platform
      • setStartDelimiter

        public void setStartDelimiter​(String startDelimiter)
        Delimiter to use for fields and tables using spaces or other special values. Some databases use different delimiters for the beginning and end of the value. This delimiter indicates the start of the value.
      • getTableQualifier

        public String getTableQualifier()
        Return the qualifier for the table. Required by some databases such as Oracle and DB2
        Specified by:
        getTableQualifier in interface Platform
      • getTimestampQuery

        public ValueReadQuery getTimestampQuery()
        This method can be overridden by subclasses to return a query that will return the timestamp from the server. return null if the time should be the local time.
        Specified by:
        getTimestampQuery in interface Platform
      • getUpdateSequenceQuery

        public DataModifyQuery getUpdateSequenceQuery()
        OBSOLETE: This method lazy initializes the update sequence number query. It allows for other queries to be used instead of the default one.
      • initializePlatformOperators

        protected void initializePlatformOperators()
        Initialize any platform-specific operators
      • initializeDefaultQueries

        public void initializeDefaultQueries​(DescriptorQueryManager queryManager,
                                             AbstractSession session)
        INTERNAL: Allow the platform to initialize the CRUD queries to defaults. This is mainly used by EIS platforms, but could be used by relational ones for special behavior.
      • isAccess

        public boolean isAccess()
        Specified by:
        isAccess in interface Platform
      • isAttunity

        public boolean isAttunity()
        Specified by:
        isAttunity in interface Platform
      • isDerby

        public boolean isDerby()
        Specified by:
        isDerby in interface Platform
      • isDB2

        public boolean isDB2()
        Specified by:
        isDB2 in interface Platform
      • isDB2Z

        public boolean isDB2Z()
        Specified by:
        isDB2Z in interface Platform
      • isHANA

        public boolean isHANA()
        Specified by:
        isHANA in interface Platform
      • isH2

        public boolean isH2()
        Specified by:
        isH2 in interface Platform
      • isDBase

        public boolean isDBase()
        Specified by:
        isDBase in interface Platform
      • isHSQL

        public boolean isHSQL()
        Specified by:
        isHSQL in interface Platform
      • isInformix

        public boolean isInformix()
        Specified by:
        isInformix in interface Platform
      • isMySQL

        public boolean isMySQL()
        Specified by:
        isMySQL in interface Platform
      • isODBC

        public boolean isODBC()
        Specified by:
        isODBC in interface Platform
      • isOracle

        public boolean isOracle()
        Specified by:
        isOracle in interface Platform
      • isOracle9

        public boolean isOracle9()
        Specified by:
        isOracle9 in interface Platform
      • isOracle12

        public boolean isOracle12()
        Specified by:
        isOracle12 in interface Platform
      • isPervasive

        public boolean isPervasive()
      • isFirebird

        public boolean isFirebird()
      • isSybase

        public boolean isSybase()
        Specified by:
        isSybase in interface Platform
      • isTimesTen

        public boolean isTimesTen()
        Specified by:
        isTimesTen in interface Platform
      • isMaxDB

        public boolean isMaxDB()
        Specified by:
        isMaxDB in interface Platform
      • initialize

        public void initialize()
        Allow the platform to initialize itself after login/init.
        Specified by:
        initialize in interface Platform
      • setSelectSequenceNumberQuery

        public void setSelectSequenceNumberQuery​(ValueReadQuery seqQuery)
        OBSOLETE: Can override the default query for returning the sequence numbers. This query must be a valid query that has one parameter which is the sequence name.
      • setSequencePreallocationSize

        public void setSequencePreallocationSize​(int size)
        Set the number of sequence values to preallocate. Preallocating sequence values can greatly improve insert performance.
      • setTableQualifier

        public void setTableQualifier​(String qualifier)
        Set the qualifier for the table. Required by some databases such as Oracle and DB2
        Specified by:
        setTableQualifier in interface Platform
      • setTimestampQuery

        public void setTimestampQuery​(ValueReadQuery tsQuery)
        Can override the default query for returning a timestamp from the server. See: getTimestampFromServer
        Specified by:
        setTimestampQuery in interface Platform
      • setUpdateSequenceQuery

        public void setUpdateSequenceQuery​(DataModifyQuery updateSequenceNumberQuery)
        This method sets the update sequence number query. It allows for other queries to be used instead of the default one.
      • getDataTypesConvertedFrom

        public Vector getDataTypesConvertedFrom​(Class javaClass)
        PUBLIC: Return the list of Classes that can be converted to from the passed in javaClass.
        Parameters:
        javaClass - - the class that is converted from
        Returns:
        - a vector of classes
      • getDataTypesConvertedTo

        public Vector getDataTypesConvertedTo​(Class javaClass)
        PUBLIC: Return the list of Classes that can be converted from to the passed in javaClass.
        Parameters:
        javaClass - - the class that is converted to
        Returns:
        - a vector of classes
      • hasDefaultSequence

        public boolean hasDefaultSequence()
        Get default sequence
      • setDefaultSequence

        public void setDefaultSequence​(Sequence sequence)
        Set default sequence. In case the passed sequence is of type DefaultSequence - use platformDefaultSequence with name and size of the passed sequence.
        Specified by:
        setDefaultSequence in interface Platform
      • addSequence

        public void addSequence​(Sequence sequence)
        Add sequence corresponding to the name
        Specified by:
        addSequence in interface Platform
      • addSequence

        public void addSequence​(Sequence sequence,
                                boolean isSessionConnected)
        Add sequence corresponding to the name. Use this method with isSessionConnected parameter set to true to add a sequence to connected session. If the session is connected then the sequence is added only if there is no sequence with the same name already in use.
        Specified by:
        addSequence in interface Platform
      • createPlatformDefaultSequence

        protected Sequence createPlatformDefaultSequence()
        INTERNAL: Create platform-default Sequence
      • removeSequence

        public Sequence removeSequence​(String seqName)
        Remove sequence corresponding to name. Doesn't remove default sequence.
        Specified by:
        removeSequence in interface Platform
      • removeAllSequences

        public void removeAllSequences()
        Remove all sequences, but the default one.
        Specified by:
        removeAllSequences in interface Platform
      • setSequences

        public void setSequences​(Map sequences)
        INTERNAL: Sets sequences - for XML support only
        Specified by:
        setSequences in interface Platform
      • usesPlatformDefaultSequence

        public boolean usesPlatformDefaultSequence()
        INTERNAL: Indicates whether defaultSequence is the same as platform default sequence.
        Specified by:
        usesPlatformDefaultSequence in interface Platform
      • shouldPrepare

        public boolean shouldPrepare​(DatabaseQuery query)
        Allows query prepare to be disable in the platform. This is required for some EIS platforms, that cannot prepare the call.
      • shouldSelectIncludeOrderBy

        public boolean shouldSelectIncludeOrderBy()
        Return if the database requires the ORDER BY fields to be part of the select clause.
      • shouldSelectDistinctIncludeOrderBy

        public boolean shouldSelectDistinctIncludeOrderBy()
        Return if the database requires the ORDER BY fields to be part of the select clause.
      • shouldNativeSequenceUseTransaction

        public boolean shouldNativeSequenceUseTransaction()
        INTERNAL: Indicates whether a separate transaction is required for NativeSequence. This method is to be used *ONLY* by sequencing classes
      • supportsIdentity

        public boolean supportsIdentity()
        INTERNAL: Indicates whether the platform supports identity. This method is to be used *ONLY* by sequencing classes
      • supportsNativeSequenceNumbers

        public boolean supportsNativeSequenceNumbers()
      • supportsSequenceObjects

        public boolean supportsSequenceObjects()
        INTERNAL: Indicates whether the platform supports sequence objects. This method is to be used *ONLY* by sequencing classes
      • buildSelectQueryForSequenceObject

        public ValueReadQuery buildSelectQueryForSequenceObject()
        INTERNAL: Returns query used to read value generated by sequence object (like Oracle sequence). This method is called when sequence object NativeSequence is connected, the returned query used until the sequence is disconnected. If the platform supportsSequenceObjects then (at least) one of buildSelectQueryForSequenceObject methods should return non-null query.
      • buildSelectQueryForSequenceObject

        public ValueReadQuery buildSelectQueryForSequenceObject​(String qualifiedSeqName,
                                                                Integer size)
        INTERNAL: Returns query used to read value generated by sequence object (like Oracle sequence). In case the other version of this method (taking no parameters) returns null, this method is called every time sequence object NativeSequence reads. If the platform supportsSequenceObjects then (at least) one of buildSelectQueryForSequenceObject methods should return non-null query.
      • buildSelectQueryForIdentity

        public ValueReadQuery buildSelectQueryForIdentity()
        INTERNAL: Returns query used to read back the value generated by Identity. This method is called when identity NativeSequence is connected, the returned query used until the sequence is disconnected. If the platform supportsIdentity then (at least) one of buildSelectQueryForIdentity methods should return non-null query.
      • buildSelectQueryForIdentity

        public ValueReadQuery buildSelectQueryForIdentity​(String seqName,
                                                          Integer size)
        INTERNAL: Returns query used to read back the value generated by Identity. In case the other version of this method (taking no parameters) returns null, this method is called every time identity NativeSequence reads. If the platform supportsIdentity then (at least) one of buildSelectQueryForIdentity methods should return non-null query.
      • buildNativeCall

        public DatasourceCall buildNativeCall​(String queryString)
        INTERNAL: Return the correct call type for the native query string. This allows EIS platforms to use different types of native calls.
      • initIdentitySequences

        public void initIdentitySequences​(Session session,
                                          String defaultIdentityGenerator)
        INTERNAL: Initialize platform specific identity sequences.
        Specified by:
        initIdentitySequences in interface Platform
        Parameters:
        session - Active database session (in connected state).
        defaultIdentityGenerator - Default identity generator sequence name.
        Since:
        2.7
      • removeIdentitySequences

        public void removeIdentitySequences​(Session session,
                                            String defaultIdentityGenerator,
                                            Set<String> tableNames)
        INTERNAL: Remove platform specific identity sequences for specified tables. Default identity sequences are restored.
        Specified by:
        removeIdentitySequences in interface Platform
        Parameters:
        session - Active database session (in connected state).
        defaultIdentityGenerator - Default identity generator sequence name.
        tableNames - Set of table names to check for identity sequence removal.
        Since:
        2.7
      • createExpressionFor

        public Expression createExpressionFor​(DatabaseField field,
                                              Expression builder,
                                              String fieldClassificationClassName)
        INTERNAL: Override this method if the platform needs to use a custom function based on the DatabaseField
        Returns:
        An expression for the given field set equal to a parameter matching the field
      • getINClauseLimit

        public int getINClauseLimit()
        INTERNAL: Some database platforms have a limit for the number of parameters in an IN clause.