Class SybasePlatform

    • Field Detail

      • typeStrings

        protected java.util.Map typeStrings
    • Constructor Detail

      • SybasePlatform

        public SybasePlatform()
    • Method Detail

      • initializeConnectionData

        public void initializeConnectionData​(java.sql.Connection connection)
                                      throws java.sql.SQLException
        Description copied from class: DatabasePlatform
        INTERNAL: Allow initialization from the connection.
        Overrides:
        initializeConnectionData in class DatabasePlatform
        Throws:
        java.sql.SQLException
      • getTypeStrings

        protected java.util.Map<java.lang.Integer,​java.lang.String> getTypeStrings()
      • initializeTypeStrings

        protected void initializeTypeStrings()
      • getJDBCType

        public int getJDBCType​(java.lang.Class javaType)
        Sybase and SQL Anywhere do not support BLOB/CLOB but require LONGVARBINARY/LONGVARCHAR.
        Overrides:
        getJDBCType in class DatabasePlatform
      • appendByteArray

        protected void appendByteArray​(byte[] bytes,
                                       java.io.Writer writer)
                                throws java.io.IOException
        If using native SQL then print a byte[] as '0xFF...'
        Overrides:
        appendByteArray in class DatabasePlatform
        Throws:
        java.io.IOException
      • appendDate

        protected void appendDate​(java.sql.Date date,
                                  java.io.Writer writer)
                           throws java.io.IOException
        Answer a platform correct string representation of a Date, suitable for SQL generation. Native format: 'yyyy-mm-dd
        Overrides:
        appendDate in class DatabasePlatform
        Throws:
        java.io.IOException
      • appendSybaseTimestamp

        protected void appendSybaseTimestamp​(java.sql.Timestamp timestamp,
                                             java.io.Writer writer)
                                      throws java.io.IOException
        Write a timestamp in Sybase specific format (yyyy-mm-dd-hh.mm.ss.fff).
        Throws:
        java.io.IOException
      • appendTime

        protected void appendTime​(java.sql.Time time,
                                  java.io.Writer writer)
                           throws java.io.IOException
        Answer a platform correct string representation of a Time, suitable for SQL generation. The time is printed in the ODBC platform independent format {t'hh:mm:ss'}.
        Overrides:
        appendTime in class DatabasePlatform
        Throws:
        java.io.IOException
      • appendTimestamp

        protected void appendTimestamp​(java.sql.Timestamp timestamp,
                                       java.io.Writer writer)
                                throws java.io.IOException
        Answer a platform correct string representation of a Timestamp, suitable for SQL generation. The date is printed in the ODBC platform independent format {d'YYYY-MM-DD'}.
        Overrides:
        appendTimestamp in class DatabasePlatform
        Throws:
        java.io.IOException
      • appendCalendar

        protected void appendCalendar​(java.util.Calendar calendar,
                                      java.io.Writer writer)
                               throws java.io.IOException
        Answer a platform correct string representation of a Calendar, suitable for SQL generation. The date is printed in the ODBC platform independent format {d'YYYY-MM-DD'}.
        Overrides:
        appendCalendar in class DatabasePlatform
        Throws:
        java.io.IOException
      • appendSybaseCalendar

        protected void appendSybaseCalendar​(java.util.Calendar calendar,
                                            java.io.Writer writer)
                                     throws java.io.IOException
        Write a timestamp in Sybase specific format ( yyyy-mm-dd-hh.mm.ss.fff)
        Throws:
        java.io.IOException
      • buildFieldTypes

        protected java.util.Hashtable buildFieldTypes()
        Description copied from class: DatabasePlatform
        Return the mapping of class types to database types for the schema framework.
        Overrides:
        buildFieldTypes in class DatabasePlatform
      • shouldPrintLockingClauseAfterWhereClause

        public boolean shouldPrintLockingClauseAfterWhereClause()
        The sybase syntax for obtaining pessimistic lock is "SELECT ADDRESS_ID, ... FROM ADDRESS WITH (HOLDLOCK) WHERE (ADDRESS_ID = ?)" Please note that above only obtains shared lock. Apparently there is no way to obtain exclusive lock on Sybase using only a select statement
        Overrides:
        shouldPrintLockingClauseAfterWhereClause in class DatabasePlatform
      • getSelectForUpdateString

        public java.lang.String getSelectForUpdateString()
        Description copied from class: DatabasePlatform
        Most database support a syntax. although don't actually lock the row. Some require the OF some don't like it.
        Overrides:
        getSelectForUpdateString in class DatabasePlatform
      • getCreationInOutputProcedureToken

        public java.lang.String getCreationInOutputProcedureToken()
        Description copied from class: DatabasePlatform
        This method is used to print the required output parameter token for the specific platform. Used when stored procedures are created.
        Overrides:
        getCreationInOutputProcedureToken in class DatabasePlatform
      • getCreationOutputProcedureToken

        public java.lang.String getCreationOutputProcedureToken()
        Description copied from class: DatabasePlatform
        This method is used to print the required output parameter token for the specific platform. Used when stored procedures are created.
        Overrides:
        getCreationOutputProcedureToken in class DatabasePlatform
      • getInOutputProcedureToken

        public java.lang.String getInOutputProcedureToken()
        Description copied from class: DatabasePlatform
        This method is used to print the output parameter token when stored procedures are called
        Overrides:
        getInOutputProcedureToken in class DatabasePlatform
      • getJdbcTypeName

        public java.lang.String getJdbcTypeName​(int jdbcType)
        INTERNAL: Returns the type name corresponding to the jdbc type
        Overrides:
        getJdbcTypeName in class DatabasePlatform
      • getMaxFieldNameSize

        public int getMaxFieldNameSize()
        INTERNAL: returns the maximum number of characters that can be used in a field name on this platform.
        Overrides:
        getMaxFieldNameSize in class DatabasePlatform
      • getNativeTableInfo

        public java.util.Vector getNativeTableInfo​(java.lang.String table,
                                                   java.lang.String creator,
                                                   AbstractSession session)
        Return the catalog information through using the native SQL catalog selects. This is required because many JDBC driver do not support meta-data. Willcards can be passed as arguments.
      • getOutputProcedureToken

        public java.lang.String getOutputProcedureToken()
        Description copied from class: DatabasePlatform
        This method is used to print the output parameter token when stored procedures are called
        Overrides:
        getOutputProcedureToken in class DatabasePlatform
      • useJDBCStoredProcedureSyntax

        public boolean useJDBCStoredProcedureSyntax()
        Return true if this platform is to use the JDBC supported syntax for executing stored procedures. If the driver is known to be the DataDirec driver, and the value is not set, then set to true and return.
      • modOperator

        protected static ExpressionOperator modOperator()
        Override the default MOD operator.
      • operatorOuterJoin

        protected static ExpressionOperator operatorOuterJoin()
        Create the outer join operator for this platform
      • singleArgumentSubstringOperator

        protected static ExpressionOperator singleArgumentSubstringOperator()
        Override the default SubstringSingleArg operator.
      • sybaseAddMonthsOperator

        protected static ExpressionOperator sybaseAddMonthsOperator()
        INTERNAL: Function, to add months to a date.
      • sybaseInStringOperator

        protected static ExpressionOperator sybaseInStringOperator()
        INTERNAL: Build instring operator
      • sybaseToNumberOperator

        protected static ExpressionOperator sybaseToNumberOperator()
        INTERNAL: Build Sybase equivalent to TO_NUMBER.
      • sybaseToDateToStringOperator

        protected static ExpressionOperator sybaseToDateToStringOperator()
        INTERNAL: Build Sybase equivalent to TO_CHAR.
      • sybaseToDateOperator

        protected static ExpressionOperator sybaseToDateOperator()
        INTERNAL: Build Sybase equivalent to TO_DATE.
      • sybaseToCharOperator

        protected static ExpressionOperator sybaseToCharOperator()
        INTERNAL: Build Sybase equivalent to TO_CHAR.
      • sybaseToCharWithFormatOperator

        protected static ExpressionOperator sybaseToCharWithFormatOperator()
        INTERNAL: Build Sybase equivalent to TO_CHAR.
      • sybaseLocateOperator

        protected static ExpressionOperator sybaseLocateOperator()
        INTERNAL: Build the Sybase equivalent to Locate
      • sybaseLocate2Operator

        protected static ExpressionOperator sybaseLocate2Operator()
        INTERNAL: Build the Sybase equivalent to Locate with a start index. Sybase does not define this, so this gets a little complex...
      • extractOperator

        protected static ExpressionOperator extractOperator()
        INTERNAL: Derby does not support EXTRACT, but does have DATEPART.
      • trimOperator

        protected static ExpressionOperator trimOperator()
        INTERNAL: Use RTRIM(LTRIM(?)) function for trim.
      • trim2Operator

        protected static ExpressionOperator trim2Operator()
        INTERNAL: Build Trim operator.
      • isOutputAllowWithResultSet

        public boolean isOutputAllowWithResultSet()
        INTERNAL: Return true if output parameters can be built with result sets.
        Overrides:
        isOutputAllowWithResultSet in class DatabasePlatform
      • maximumNumericValues

        public java.util.Hashtable<java.lang.Class<? extends java.lang.Number>,​java.lang.Number> maximumNumericValues()
        Builds a table of maximum numeric values keyed on java class. This is used for type testing but might also be useful to end users attempting to sanitize values.

        NOTE: BigInteger & BigDecimal maximums are dependent upon their precision & Scale

        Overrides:
        maximumNumericValues in class DatabasePlatform
      • minimumNumericValues

        public java.util.Hashtable<java.lang.Class<? extends java.lang.Number>,​java.lang.Number> minimumNumericValues()
        Builds a table of minimum numeric values keyed on java class. This is used for type testing but might also be useful to end users attempting to sanitize values.

        NOTE: BigInteger & BigDecimal minimums are dependent upon their precision & Scale

        Overrides:
        minimumNumericValues in class DatabasePlatform
      • registerOutputParameter

        public void registerOutputParameter​(java.sql.CallableStatement statement,
                                            int index,
                                            int jdbcType)
                                     throws java.sql.SQLException
        This method is used to register output parameter on Callable Statements for Stored Procedures as each database seems to have a different method.
        Overrides:
        registerOutputParameter in class DatabasePlatform
        Throws:
        java.sql.SQLException
        See Also:
        CallableStatement.registerOutParameter(int parameterIndex, int sqlType)
      • registerOutputParameter

        public void registerOutputParameter​(java.sql.CallableStatement statement,
                                            int index,
                                            int jdbcType,
                                            java.lang.String typeName)
                                     throws java.sql.SQLException
        Description copied from class: DatabasePlatform
        This method is used to register output parameter on CallableStatements for Stored Procedures as each database seems to have a different method.
        Overrides:
        registerOutputParameter in class DatabasePlatform
        Throws:
        java.sql.SQLException
        See Also:
        CallableStatement.registerOutParameter(int parameterIndex, int sqlType, String typeName)
      • requiresTypeNameToRegisterOutputParameter

        public boolean requiresTypeNameToRegisterOutputParameter()
        INTERNAL: Indicates whether the version of CallableStatement.registerOutputParameter method that takes type name should be used.
        Overrides:
        requiresTypeNameToRegisterOutputParameter in class DatabasePlatform
      • shouldUseJDBCOuterJoinSyntax

        public boolean shouldUseJDBCOuterJoinSyntax()
        JDBC defines and outer join syntax, many drivers do not support this. So we normally avoid it.
        Overrides:
        shouldUseJDBCOuterJoinSyntax in class DatabasePlatform
      • supportsIdentity

        public boolean supportsIdentity()
        INTERNAL: Indicates whether the platform supports identity. Sybase does through IDENTITY field types. This method is to be used *ONLY* by sequencing classes
        Overrides:
        supportsIdentity in class DatasourcePlatform
      • supportsDeleteOnCascade

        public boolean supportsDeleteOnCascade()
        Sybase (as of Sybase ASE 15, does not support delete on cascade). Sybase ASA (SQL Anywhere does, so must use different platform).
        Overrides:
        supportsDeleteOnCascade in class DatabasePlatform
      • writeUpdateOriginalFromTempTableSql

        public void writeUpdateOriginalFromTempTableSql​(java.io.Writer writer,
                                                        DatabaseTable table,
                                                        java.util.Collection pkFields,
                                                        java.util.Collection assignedFields)
                                                 throws java.io.IOException
        INTERNAL:
        Overrides:
        writeUpdateOriginalFromTempTableSql in class DatabasePlatform
        Throws:
        java.io.IOException