EclipseLink 1.0_1.0M2 API Reference - Incubation

org.eclipse.persistence.platform.database
Class SybasePlatform

java.lang.Object
  extended by org.eclipse.persistence.internal.databaseaccess.DatabasePlatform
      extended by org.eclipse.persistence.platform.database.DatabasePlatform
          extended by org.eclipse.persistence.platform.database.SybasePlatform
Direct Known Subclasses:
SQLAnyWherePlatform

public class SybasePlatform
extends DatabasePlatform

Purpose: Provides Sybase specific behaviour.

Responsibilities:

Since:
TOPLink/Java 1.0

Field Summary
protected  java.util.Map typeStrings
           
 
Constructor Summary
SybasePlatform()
           
 
Method Summary
protected  void appendByteArray(byte[] bytes, java.io.Writer writer)
          If using native SQL then print a byte[] as '0xFF...'
protected  void appendCalendar(java.util.Calendar calendar, java.io.Writer writer)
          Answer a platform correct string representation of a Calendar, suitable for SQL generation.
protected  void appendDate(java.sql.Date date, java.io.Writer writer)
          Answer a platform correct string representation of a Date, suitable for SQL generation.
protected  void appendSybaseCalendar(java.util.Calendar calendar, java.io.Writer writer)
          Write a timestamp in Sybase specific format ( yyyy-mm-dd-hh.mm.ss.fff)
protected  void appendSybaseTimestamp(java.sql.Timestamp timestamp, java.io.Writer writer)
          Write a timestamp in Sybase specific format (yyyy-mm-dd-hh.mm.ss.fff).
protected  void appendTime(java.sql.Time time, java.io.Writer writer)
          Answer a platform correct string representation of a Time, suitable for SQL generation.
protected  void appendTimestamp(java.sql.Timestamp timestamp, java.io.Writer writer)
          Answer a platform correct string representation of a Timestamp, suitable for SQL generation.
 ExpressionOperator atan2Operator()
          INTERNAL: Build operator.
protected  java.util.Hashtable buildFieldTypes()
           
 ValueReadQuery buildSelectQueryForIdentity()
          INTERNAL: Build the identity query for native sequencing.
 java.lang.Object executeStoredProcedure(DatabaseCall dbCall, java.sql.PreparedStatement statement, DatabaseAccessor accessor, AbstractSession session)
          because each platform has different requirements for accessing stored procedures and the way that we can combine resultsets and output params the stored procedure call is being executed on the platform.
 java.lang.String getBatchDelimiterString()
          Used for batch writing and sp defs.
protected  java.lang.String getCreateTempTableSqlPrefix()
          INTERNAL:
 java.lang.String getCreationInOutputProcedureToken()
           
 java.lang.String getCreationOutputProcedureToken()
           
 java.lang.String getInOutputProcedureToken()
           
 java.lang.String getJdbcTypeName(int jdbcType)
          INTERNAL: Returns the type name corresponding to the jdbc type
 int getMaxFieldNameSize()
          INTERNAL: returns the maximum number of characters that can be used in a field name on this platform.
 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.
 java.lang.String getOutputProcedureToken()
           
 java.lang.String getProcedureArgumentString()
          Used for sp defs.
 java.lang.String getProcedureCallHeader()
          Used for sp calls.
 java.lang.String getStoredProcedureParameterPrefix()
           
 java.lang.String getStoredProcedureTerminationToken()
          INTERNAL: This method returns the delimiter between stored procedures in multiple stored procedure calls.
 DatabaseTable getTempTableForTable(DatabaseTable table)
          INTERNAL:
 ValueReadQuery getTimestampQuery()
          PUBLIC: This method returns the query to select the timestamp from the server for Sybase.
protected  java.util.Map getTypeStrings()
           
protected  void initializePlatformOperators()
          Initialize any platform-specific operators
protected  void initializeTypeStrings()
           
 boolean isSybase()
           
 java.util.Hashtable maximumNumericValues()
          Builds a table of maximum numeric values keyed on java class.
 java.util.Hashtable minimumNumericValues()
          Builds a table of minimum numeric values keyed on java class.
 ExpressionOperator modOperator()
          Override the default MOD operator.
protected  ExpressionOperator operatorOuterJoin()
           
 void printFieldIdentityClause(java.io.Writer writer)
          Append the receiver's field 'identity' constraint clause to a writer.
 void printFieldNullClause(java.io.Writer writer)
          Append the receiver's field 'NULL' constraint clause to a writer.
 void registerOutputParameter(java.sql.CallableStatement statement, int index, int jdbcType)
          This method is used to register output parameter on Callable Statements for Stored Procedures as each database seems to have a different method.
 boolean requiresProcedureCallBrackets()
          USed for sp calls.
 boolean requiresProcedureCallOuputToken()
          Used for sp calls.
 boolean requiresTypeNameToRegisterOutputParameter()
          INTERNAL: Indicates whether the version of CallableStatement.registerOutputParameter method that takes type name should be used.
 boolean shouldPrintInOutputTokenBeforeType()
           
 boolean shouldPrintOuterJoinInWhereClause()
          Some database require outer joins to be given in the where clause, others require it in the from clause.
 boolean shouldPrintOutputTokenBeforeType()
           
 boolean shouldUseJDBCOuterJoinSyntax()
          JDBC defines and outer join syntax, many drivers do not support this.
 boolean supportsIdentity()
          INTERNAL: Indicates whether the platform supports identity.
 boolean supportsLocalTempTables()
          INTERNAL:
 void writeUpdateOriginalFromTempTableSql(java.io.Writer writer, DatabaseTable table, java.util.Collection pkFields, java.util.Collection assignedFields)
          INTERNAL:
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

typeStrings

protected java.util.Map typeStrings
Constructor Detail

SybasePlatform

public SybasePlatform()
Method Detail

getTypeStrings

protected java.util.Map getTypeStrings()

initializeTypeStrings

protected void initializeTypeStrings()

appendByteArray

protected void appendByteArray(byte[] bytes,
                               java.io.Writer writer)
                        throws java.io.IOException
If using native SQL then print a byte[] as '0xFF...'

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

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'}.

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'}.

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'}.

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

atan2Operator

public ExpressionOperator atan2Operator()
INTERNAL: Build operator.


buildFieldTypes

protected java.util.Hashtable buildFieldTypes()

buildSelectQueryForIdentity

public ValueReadQuery buildSelectQueryForIdentity()
INTERNAL: Build the identity query for native sequencing.


executeStoredProcedure

public java.lang.Object executeStoredProcedure(DatabaseCall dbCall,
                                               java.sql.PreparedStatement statement,
                                               DatabaseAccessor accessor,
                                               AbstractSession session)
                                        throws java.sql.SQLException
because each platform has different requirements for accessing stored procedures and the way that we can combine resultsets and output params the stored procedure call is being executed on the platform. This entire process needs some serious refactoring to eliminate the chance of bugs.

Throws:
java.sql.SQLException

getBatchDelimiterString

public java.lang.String getBatchDelimiterString()
Used for batch writing and sp defs.


getCreationInOutputProcedureToken

public java.lang.String getCreationInOutputProcedureToken()

getCreationOutputProcedureToken

public java.lang.String getCreationOutputProcedureToken()

getInOutputProcedureToken

public java.lang.String getInOutputProcedureToken()

getJdbcTypeName

public java.lang.String getJdbcTypeName(int jdbcType)
INTERNAL: Returns the type name corresponding to the jdbc type


getMaxFieldNameSize

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


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()

getProcedureArgumentString

public java.lang.String getProcedureArgumentString()
Used for sp defs.


getProcedureCallHeader

public java.lang.String getProcedureCallHeader()
Used for sp calls.


getStoredProcedureParameterPrefix

public java.lang.String getStoredProcedureParameterPrefix()

getStoredProcedureTerminationToken

public java.lang.String getStoredProcedureTerminationToken()
INTERNAL: This method returns the delimiter between stored procedures in multiple stored procedure calls.


getTimestampQuery

public ValueReadQuery getTimestampQuery()
PUBLIC: This method returns the query to select the timestamp from the server for Sybase.


initializePlatformOperators

protected void initializePlatformOperators()
Initialize any platform-specific operators


isSybase

public boolean isSybase()

maximumNumericValues

public java.util.Hashtable 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


minimumNumericValues

public java.util.Hashtable 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


modOperator

public ExpressionOperator modOperator()
Override the default MOD operator.


operatorOuterJoin

protected ExpressionOperator operatorOuterJoin()

printFieldIdentityClause

public void printFieldIdentityClause(java.io.Writer writer)
                              throws ValidationException
Append the receiver's field 'identity' constraint clause to a writer.

Throws:
ValidationException

printFieldNullClause

public void printFieldNullClause(java.io.Writer writer)
                          throws ValidationException
Append the receiver's field 'NULL' constraint clause to a writer.

Throws:
ValidationException

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.

Throws:
java.sql.SQLException

requiresProcedureCallBrackets

public boolean requiresProcedureCallBrackets()
USed for sp calls.


requiresProcedureCallOuputToken

public boolean requiresProcedureCallOuputToken()
Used for sp calls. Sybase must print output after output params.


requiresTypeNameToRegisterOutputParameter

public boolean requiresTypeNameToRegisterOutputParameter()
INTERNAL: Indicates whether the version of CallableStatement.registerOutputParameter method that takes type name should be used.


shouldPrintInOutputTokenBeforeType

public boolean shouldPrintInOutputTokenBeforeType()

shouldPrintOuterJoinInWhereClause

public boolean shouldPrintOuterJoinInWhereClause()
Some database require outer joins to be given in the where clause, others require it in the from clause.


shouldPrintOutputTokenBeforeType

public boolean shouldPrintOutputTokenBeforeType()

shouldUseJDBCOuterJoinSyntax

public boolean shouldUseJDBCOuterJoinSyntax()
JDBC defines and outer join syntax, many drivers do not support this. So we normally avoid it.


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


supportsLocalTempTables

public boolean supportsLocalTempTables()
INTERNAL:


getCreateTempTableSqlPrefix

protected java.lang.String getCreateTempTableSqlPrefix()
INTERNAL:


getTempTableForTable

public DatabaseTable getTempTableForTable(DatabaseTable table)
INTERNAL:


writeUpdateOriginalFromTempTableSql

public void writeUpdateOriginalFromTempTableSql(java.io.Writer writer,
                                                DatabaseTable table,
                                                java.util.Collection pkFields,
                                                java.util.Collection assignedFields)
                                         throws java.io.IOException
INTERNAL:

Throws:
java.io.IOException

EclipseLink 1.0_1.0M2 API Reference - Incubation