Top Description Inners Fields Constructors Methods
org.eclipse.persistence.platform.database

public Class SQLServerPlatform

extends DatabasePlatform
Class Inheritance
Imports
java.io.*, java.sql.CallableStatement, .Connection, .DatabaseMetaData, .PreparedStatement, .ResultSet, .SQLException, java.time.LocalDate, .LocalDateTime, .LocalTime, .OffsetDateTime, .OffsetTime, java.util.*, org.eclipse.persistence.exceptions.*, org.eclipse.persistence.expressions.*, org.eclipse.persistence.internal.expressions.*, org.eclipse.persistence.internal.helper.*, org.eclipse.persistence.internal.sessions.AbstractSession, org.eclipse.persistence.internal.databaseaccess.*, org.eclipse.persistence.queries.*

Purpose: Provides SQL Server specific behavior.

Responsibilities:

Since
TOPLink/Java 1.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static final int
DATETIMEOFFSET_TYPE

MSSQL-specific JDBC type constants

private Boolean
driverSupportsOffsetDateTime

The official MS JDBC driver fully supports ODT since version 7.1.4

private boolean
private boolean
isVersion11OrHigher

Support for sequence objects and OFFSET FETCH NEXT added in SQL Server 2012

Inherited from org.eclipse.persistence.platform.database.DatabasePlatform:
DEFAULT_VARCHAR_SIZE

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected static ExpressionOperator
addMonthsOperator()

INTERNAL: Function, to add months to a date.

protected void
appendByteArray(byte[] bytes, Writer writer)

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.appendByteArray.

If using native SQL then print a byte[] as '0xFF...'
protected void
appendCalendar(Calendar calendar, Writer writer)

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.appendCalendar.

Answer a platform correct string representation of a Calendar, suitable for SQL generation.
protected void
appendDate(Date date, Writer writer)

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.appendDate.

Answer a platform correct string representation of a Date, suitable for SQL generation.
protected void
appendSybaseCalendar(Calendar calendar, Writer writer)

Write a timestamp in Sybase specific format ( yyyy-mm-dd-hh.mm.ss.fff)

protected void
appendSybaseTimestamp(Timestamp timestamp, Writer writer)

Write a timestamp in Sybase specific format ( yyyy-mm-dd-hh.mm.ss.fff)

protected void
appendTime(Time time, Writer writer)

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.appendTime.

Answer a platform correct string representation of a Time, suitable for SQL generation.
protected void
appendTimestamp(Timestamp timestamp, Writer writer)

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.appendTimestamp.

Answer a platform correct string representation of a Timestamp, suitable for SQL generation.
protected Map<String, Class<?>>
buildClassTypes()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.buildClassTypes.

Return the mapping of class types to database types for the schema framework.
protected Hashtable<Class<?>, FieldTypeDefinition>
buildFieldTypes()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.buildFieldTypes.

Return the mapping of class types to database types for the schema framework.
public ValueReadQuery
public ValueReadQuery
buildSelectQueryForSequenceObject(String
a defined database sequence
qualifiedSeqName
,
Integer size)

Overrides org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform.buildSelectQueryForSequenceObject.

INTERNAL: Produce a DataReadQuery which updates(!) the sequence number in the database and returns it.
public Map<Object, Object>
connectionProperties()

Overrides default org.eclipse.persistence.internal.databaseaccess.Platform.connectionProperties.

INTERNAL: Get platform specific connection properties.
public boolean
dontBindUpdateAllQueryUsingTempTables()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.dontBindUpdateAllQueryUsingTempTables.

INTERNAL: In SQLServer local temporary table created by one PreparedStatement can't be used in another PreparedStatement.
public String
protected String
public String
getCreationInOutputProcedureToken()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getCreationInOutputProcedureToken.

This method is used to print the required output parameter token for the specific platform.
public String
getCreationOutputProcedureToken()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getCreationOutputProcedureToken.

This method is used to print the required output parameter token for the specific platform.
public String
getInOutputProcedureToken()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getInOutputProcedureToken.

This method is used to print the output parameter token when stored procedures are called
public int
getMaxFieldNameSize()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getMaxFieldNameSize.

INTERNAL: returns the maximum number of characters that can be used in a field name on this platform.
public Vector<E>
getNativeTableInfo(String table, String creator, AbstractSession session)

Return the catalog information through using the native SQL catalog selects.

public Object
getObjectFromResultSet(ResultSet resultSet, int columnNumber, int type, AbstractSession session)

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getObjectFromResultSet.

INTERNAL: Get the object from the JDBC Result set.
public String
getOutputProcedureToken()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getOutputProcedureToken.

This method is used to print the output parameter token when stored procedures are called
public String
public String
public String
public String
public String
public DatabaseTable
getTempTableForTable(DatabaseTable
is original table for which temp table is created.
table
)

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.getTempTableForTable.

INTERNAL:
public ValueReadQuery
getTimestampQuery()

Overrides org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform.getTimestampQuery.

Implements org.eclipse.persistence.internal.databaseaccess.Platform.getTimestampQuery.

PUBLIC: This method returns the query to select the timestamp from the server for SQLServer.
public void
protected void
protected static ExpressionOperator
inStringOperator()

INTERNAL: Build instring operator

public boolean
isOutputAllowWithResultSet()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.isOutputAllowWithResultSet.

INTERNAL: Return true if output parameters can be built with result sets.
public boolean
protected static ExpressionOperator
locate2Operator()

INTERNAL: create the Locate2 Operator for this platform

protected static ExpressionOperator
locateOperator()

INTERNAL: Build the Sybase equivalent to Locate

public Hashtable<Class<? extends Number>, ? super Number>
maximumNumericValues()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.maximumNumericValues.

Builds a table of maximum numeric values keyed on java class.
public Hashtable<Class<? extends Number>, ? super Number>
minimumNumericValues()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.minimumNumericValues.

Builds a table of minimum numeric values keyed on java class.
protected ExpressionOperator
modOperator()

Override the default MOD operator.

private static ExpressionOperator
protected static ExpressionOperator
public void
printFieldIdentityClause(Writer writer)

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.printFieldIdentityClause.

INTERNAL: Append the receiver's field 'identity' constraint clause to a writer.
public void
printFieldNullClause(Writer writer)

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.printFieldNullClause.

INTERNAL: Append the receiver's field 'NULL' constraint clause to a writer.
public void
printSQLSelectStatement(DatabaseCall call, ExpressionSQLPrinter printer, SQLSelectStatement statement)

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.printSQLSelectStatement.

INTERNAL: Print the SQL representation of the statement on a stream, storing the fields in the DatabaseCall.
public boolean
public boolean
public void
setDriverSupportsOffsetDateTime(boolean driverSupportsOffsetDateTime)

Allow user to turn off ODT support, in case they rely on the old behavior.

public void
setParameterValueInDatabaseCall(Object parameter, PreparedStatement statement, int index, AbstractSession session)

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.setParameterValueInDatabaseCall.

INTERNAL Set the parameter in the JDBC statement at the given index.
public void
setParameterValueInDatabaseCall(Object parameter, CallableStatement statement, String name, AbstractSession session)

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.setParameterValueInDatabaseCall.

INTERNAL Set the parameter in the JDBC statement with the given name.
public boolean
shouldPrintInOutputTokenBeforeType()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.shouldPrintInOutputTokenBeforeType.

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

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.shouldPrintLockingClauseAfterWhereClause.

INTERNAL: Indicates whether locking clause should be printed after where clause by SQLSelectStatement.
public boolean
shouldPrintOutputTokenBeforeType()

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.shouldPrintOutputTokenBeforeType.

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

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.shouldUseJDBCOuterJoinSyntax.

JDBC defines and outer join syntax, many drivers do not support this.
protected static ExpressionOperator
singleArgumentSubstringOperator()

Override the default SubstringSingleArg operator.

public boolean
supportsIdentity()

Overrides org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform.supportsIdentity.

INTERNAL: Indicates whether the platform supports identity.
public boolean
public boolean
protected static ExpressionOperator
toCharOperator()

INTERNAL: Build Sybase equivalent to TO_CHAR.

protected static ExpressionOperator
toDateOperator()

INTERNAL: Build Sybase equivalent to TO_DATE.

protected static ExpressionOperator
toDateToStringOperator()

INTERNAL: Build Sybase equivalent to TO_CHAR.

protected static ExpressionOperator
toNumberOperator()

INTERNAL: Build Sybase equivalent to TO_NUMBER.

protected static ExpressionOperator
trim2Operator()

INTERNAL: Build Trim operator.

protected static ExpressionOperator
trimOperator()

INTERNAL: Use RTRIM(LTRIM(?)) function for trim.

public void
writeUpdateOriginalFromTempTableSql(Writer
for writing the sql
writer
,
DatabaseTable
is original table for which temp table is created.
table
,
Collection<DatabaseField>
primary key fields for the original table.
pkFields
,
Collection<DatabaseField>
fields to be assigned a new value.
assignedFields
)

Overrides org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.writeUpdateOriginalFromTempTableSql.

INTERNAL: