EclipseLink 1.0_1.0M2 API Reference - Incubation

org.eclipse.persistence.platform.database
Class SQLServerPlatform

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.SQLServerPlatform

public class SQLServerPlatform
extends DatabasePlatform

Purpose: Provides SQL Server specific behaviour.

Responsibilities:

Since:
TOPLink/Java 1.0

Constructor Summary
SQLServerPlatform()
           
 
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.
protected  java.util.Hashtable buildFieldTypes()
           
 ValueReadQuery buildSelectQueryForIdentity()
          INTERNAL: Build the identity query for native sequencing.
 java.lang.String getBatchDelimiterString()
          Used for batch writing and sp defs.
protected  java.lang.String getCreateTempTableSqlPrefix()
          INTERNAL:
 java.lang.String getCreationInOutputProcedureToken()
          This method is used to print the required output parameter token for the specific platform.
 java.lang.String getCreationOutputProcedureToken()
          This method is used to print the required output parameter token for the specific platform.
 java.lang.String getInOutputProcedureToken()
          This method is used to print the output parameter token when stored procedures are called
 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()
          This method is used to print the output parameter token when stored procedures are called
 java.lang.String getProcedureArgumentString()
          Used for sp defs.
 java.lang.String getProcedureCallHeader()
          Used for sp calls.
 java.lang.String getSelectForUpdateNoWaitString()
          INTERNAL: This syntax does no wait on the lock.
 java.lang.String getSelectForUpdateString()
          INTERNAL: Lock.
 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 SQLServer.
protected  void initializePlatformOperators()
          Initialize any platform-specific operators
 boolean isSQLServer()
           
static ExpressionOperator locate2Operator()
          INTERNAL: create the Locate2 Operator for this platform
 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)
          INTERNAL: Append the receiver's field 'identity' constraint clause to a writer.
 void printFieldNullClause(java.io.Writer writer)
          INTERNAL: Append the receiver's field 'NULL' constraint clause to a writer.
 boolean requiresProcedureCallBrackets()
          USed for sp calls.
 boolean requiresProcedureCallOuputToken()
          Used for sp calls.
 boolean shouldPrintInOutputTokenBeforeType()
          This is required in the construction of the stored procedures with output parameters
 boolean shouldPrintLockingClauseAfterWhereClause()
          INTERNAL: Indicates whether locking clause should be printed after where clause by SQLSelectStatement.
 boolean shouldPrintOuterJoinInWhereClause()
          Some database require outer joins to be given in the where clause, others require it in the from clause.
 boolean shouldPrintOutputTokenBeforeType()
          This is required in the construction of the stored procedures with output parameters
 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
 

Constructor Detail

SQLServerPlatform

public SQLServerPlatform()
Method Detail

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

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

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

buildFieldTypes

protected java.util.Hashtable buildFieldTypes()

buildSelectQueryForIdentity

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


getBatchDelimiterString

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


getCreationInOutputProcedureToken

public java.lang.String getCreationInOutputProcedureToken()
This method is used to print the required output parameter token for the specific platform. Used when stored procedures are created.


getCreationOutputProcedureToken

public java.lang.String getCreationOutputProcedureToken()
This method is used to print the required output parameter token for the specific platform. Used when stored procedures are created.


getInOutputProcedureToken

public java.lang.String getInOutputProcedureToken()
This method is used to print the output parameter token when stored procedures are called


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()
This method is used to print the output parameter token when stored procedures are called


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 SQLServer.


getSelectForUpdateString

public java.lang.String getSelectForUpdateString()
INTERNAL: Lock. UPDLOCK seems like the correct table hint to use: HOLDLOCK is too weak - doesn't lock out another read with HOLDLOCK, XLOCK is too strong - locks out another read which doesn't use any locks. UPDLOCK seems to behave exactly like Oracle's FOR UPDATE: locking out updates and other reads with FOR UPDATE but allowing other reads without locks. SQLServer seems to decide itself on the granularity of the lock - it could lock more than the returned rows (for instance a page). It could be forced to obtain to make sure to obtain row level lock: WITH (UPDLOCK, ROWLOCK) However this approach is strongly discouraged because it can consume too much resources: selecting 900 rows from and requiring a "personal" lock for each row may not be feasible because of not enough memory available at the moment - in that case SQLServer will wait until the resource becomes available.


getSelectForUpdateNoWaitString

public java.lang.String getSelectForUpdateNoWaitString()
INTERNAL: This syntax does no wait on the lock.


shouldPrintLockingClauseAfterWhereClause

public boolean shouldPrintLockingClauseAfterWhereClause()
INTERNAL: Indicates whether locking clause should be printed after where clause by SQLSelectStatement. Example: on Oracle platform (method returns true): SELECT ADDRESS_ID, ... FROM ADDRESS WHERE (ADDRESS_ID = ?) FOR UPDATE on SQLServer platform (method returns false): SELECT ADDRESS_ID, ... FROM ADDRESS WITH (UPDLOCK) WHERE (ADDRESS_ID = ?)


initializePlatformOperators

protected void initializePlatformOperators()
Initialize any platform-specific operators


isSQLServer

public boolean isSQLServer()

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

locate2Operator

public static ExpressionOperator locate2Operator()
INTERNAL: create the Locate2 Operator for this platform


printFieldIdentityClause

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

Throws:
ValidationException

printFieldNullClause

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

Throws:
ValidationException

requiresProcedureCallBrackets

public boolean requiresProcedureCallBrackets()
USed for sp calls.


requiresProcedureCallOuputToken

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


shouldPrintInOutputTokenBeforeType

public boolean shouldPrintInOutputTokenBeforeType()
This is required in the construction of the stored procedures with output parameters


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()
This is required in the construction of the stored procedures with output parameters


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. SQLServer 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