org.apache.openjpa.jdbc.sql
Class SQLServerDictionary

java.lang.Object
  extended by org.apache.openjpa.jdbc.sql.DBDictionary
      extended by org.apache.openjpa.jdbc.sql.AbstractSQLServerDictionary
          extended by org.apache.openjpa.jdbc.sql.SQLServerDictionary
All Implemented Interfaces:
JoinSyntaxes, Configurable, IdentifierConfiguration, ConnectionDecorator, LoggingConnectionDecorator.SQLWarningHandler

public class SQLServerDictionary
extends AbstractSQLServerDictionary

Dictionary for Microsoft SQL Server.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.openjpa.jdbc.sql.DBDictionary
DBDictionary.SerializedData
 
Field Summary
 boolean uniqueIdentifierAsVarbinary
          Flag whether to treat UNIQUEIDENTIFIER as VARBINARY or VARCHAR
static String VENDOR_JTDS
           
static String VENDOR_MICROSOFT
           
static String VENDOR_NETDIRECT
           
 
Fields inherited from class org.apache.openjpa.jdbc.sql.DBDictionary
allowsAliasInBulkClause, arrayTypeName, autoAssignClause, autoAssignTypeName, batchLimit, bigintTypeName, binaryTypeName, bitLengthFunction, bitTypeName, blobBufferSize, blobTypeName, booleanTypeName, castFunction, catalogSeparator, CENTI, characterColumnSize, charTypeName, clobBufferSize, clobTypeName, closePoolSQL, concatenateDelimiter, concatenateFunction, conf, connected, CONS_NAME_AFTER, CONS_NAME_BEFORE, CONS_NAME_MID, constraintNameMode, createPrimaryKeys, crossJoinClause, currentDateFunction, currentTimeFunction, currentTimestampFunction, datePrecision, dateTypeName, DECI, decimalTypeName, delimitedCase, distinctCountColumnSeparator, distinctTypeName, doubleTypeName, driverVendor, dropTableSQL, fixedSizeTypeNames, fixedSizeTypeNameSet, floatTypeName, forUpdateClause, getStringVal, inClauseLimit, initializationSQL, innerJoinClause, integerTypeName, invalidColumnWordSet, isJDBC3, javaObjectTypeName, joinSyntax, lastGeneratedKeyQuery, leadingDelimiter, log, longVarbinaryTypeName, longVarcharTypeName, maxAutoAssignNameLength, maxColumnNameLength, maxConstraintNameLength, maxEmbeddedBlobSize, maxEmbeddedClobSize, maxIndexesPerTable, maxIndexNameLength, maxTableNameLength, MICRO, MILLI, NAME_ANY, NAME_SEQUENCE, NAME_TABLE, nameConcatenator, NANO, nativeSequenceType, nextSequenceQuery, NO_BATCH, nullTypeName, numericTypeName, otherTypeName, outerJoinClause, platform, RANGE_POST_DISTINCT, RANGE_POST_LOCK, RANGE_POST_SELECT, RANGE_PRE_DISTINCT, rangePosition, realTypeName, refTypeName, reportsSuccessNoInfoOnBatchUpdates, requiresAliasForSubselect, requiresAutoCommitForMetaData, requiresCastForComparisons, requiresCastForMathFunctions, requiresConditionForCrossJoin, requiresSearchStringEscapeForLike, requiresTargetForDelete, reservedWords, reservedWordSet, SCHEMA_CASE_LOWER, SCHEMA_CASE_PRESERVE, SCHEMA_CASE_UPPER, searchStringEscape, SEC, selectWords, selectWordSet, sequenceNameSQL, sequenceSchemaSQL, sequenceSQL, setStringRightTruncationOn, simulateLocking, smallintTypeName, sqlStateCodes, storageLimitationsFatal, storeCharsAsNumbers, storeLargeNumbersAsStrings, stringLengthFunction, structTypeName, substringFunctionName, supportsAlterTableWithAddColumn, supportsAlterTableWithDropColumn, supportsAutoAssign, supportsCascadeDeleteAction, supportsCascadeUpdateAction, supportsCaseConversionForLob, supportsComments, supportsCorrelatedSubselect, supportsDefaultDeleteAction, supportsDefaultUpdateAction, supportsDeferredConstraints, supportsDelimitedIdentifiers, supportsForeignKeys, supportsForeignKeysComposite, supportsGeneralCaseExpression, supportsGetGeneratedKeys, supportsHaving, supportsLockingWithDistinctClause, supportsLockingWithInnerJoin, supportsLockingWithMultipleTables, supportsLockingWithOrderClause, supportsLockingWithOuterJoin, supportsLockingWithSelectRange, supportsModOperator, supportsMultipleNontransactionalResultSets, supportsNullDeleteAction, supportsNullTableForGetColumns, supportsNullTableForGetImportedKeys, supportsNullTableForGetIndexInfo, supportsNullTableForGetPrimaryKeys, supportsNullUpdateAction, supportsParameterInSelect, supportsQueryTimeout, supportsRestrictDeleteAction, supportsRestrictUpdateAction, supportsSchemaForGetColumns, supportsSchemaForGetTables, supportsSelectEndIndex, supportsSelectForUpdate, supportsSelectFromFinalTable, supportsSelectStartIndex, supportsSimpleCaseExpression, supportsSubselect, supportsUniqueConstraints, supportsXMLColumn, systemSchemas, systemSchemaSet, systemTables, systemTableSet, tableForUpdateClause, tableTypes, timestampTypeName, timeTypeName, tinyintTypeName, toLowerCaseFunction, toUpperCaseFunction, trailingDelimiter, trimBothFunction, trimLeadingFunction, trimSchemaName, trimTrailingFunction, typeModifierSet, UNLIMITED, useGetBestRowIdentifierForPrimaryKeys, useGetBytesForBlobs, useGetObjectForBlobs, useGetStringForClobs, useSchemaName, useSetBytesForBlobs, useSetStringForClobs, useWildCardForCount, validationSQL, varbinaryTypeName, varcharTypeName, VENDOR_DATADIRECT, VENDOR_OTHER, xmlTypeEncoding, xmlTypeName
 
Fields inherited from interface org.apache.openjpa.jdbc.sql.JoinSyntaxes
SYNTAX_DATABASE, SYNTAX_SQL92, SYNTAX_TRADITIONAL
 
Constructor Summary
SQLServerDictionary()
           
 
Method Summary
protected  void appendLength(SQLBuffer buf, int type)
           
 void appendXmlComparison(SQLBuffer buf, String op, FilterValue lhs, FilterValue rhs, boolean lhsxml, boolean rhsxml)
          If this dictionary supports XML type, use this method to append xml predicate.
 void connectedConfiguration(Connection conn)
          This method is called when the dictionary first sees any connection.
 Reader getCharacterStream(ResultSet rs, int column)
          Obtain a Reader by using ResultSet.getClob(int) and Clob.getCharacterStream().
 Column[] getColumns(DatabaseMetaData meta, DBIdentifier catalog, DBIdentifier schemaName, DBIdentifier tableName, DBIdentifier columnName, Connection conn)
          Reflect on the schema to find columns matching the given table and column patterns.
 Column[] getColumns(DatabaseMetaData meta, String catalog, String schemaName, String tableName, String columnName, Connection conn)
          Reflect on the schema to find columns matching the given table and column patterns.
 InputStream getLOBStream(JDBCStore store, ResultSet rs, int column)
          Obtain an InputStream by using ResultSet.getBlob(int) and Blob.getBinaryStream().
 String getSchemaCase()
          Return DB specific schemaCase
 boolean isFatalException(int subtype, SQLException ex)
          Determine if the given SQL Exception is fatal or recoverable (such as a timeout).
 void setSupportsXMLColumn(boolean b)
           
 
Methods inherited from class org.apache.openjpa.jdbc.sql.AbstractSQLServerDictionary
appendSelectRange, getFullName, indexOf, setNull, substring
 
Methods inherited from class org.apache.openjpa.jdbc.sql.DBDictionary
addCastAsType, addErrorCode, appendCast, appendNumericCast, appendSelect, appendSize, appendUpdates, assertSupport, calculateValue, canOuterJoin, closeDataSource, combineForeignKey, comment, comparison, configureNamingRules, convertSchemaCase, convertSchemaCase, copy, copy, createIndexIfNecessary, createIndexIfNecessary, decorate, deleteStream, delimitAll, endConfiguration, executeQuery, fromDBName, getAddColumnSQL, getAddForeignKeySQL, getAddPrimaryKeySQL, getArray, getAsciiStream, getBatchFetchSize, getBatchLimit, getBatchUpdateCount, getBigDecimal, getBigInteger, getBinaryStream, getBlob, getBlobObject, getBoolean, getByte, getBytes, getCalendar, getCastFunction, getCastFunction, getCatalogNameForMetadata, getCatalogNameForMetadata, getChar, getClob, getClobString, getColumnDBName, getColumnIdentifier, getColumnNameForMetadata, getColumnNameForMetadata, getConversionKey, getCreateIndexSQL, getCreateSequenceSQL, getCreateTableSQL, getDate, getDate, getDeclareColumnSQL, getDefaultIdentifierRule, getDefaultSchemaName, getDeleteTableContentsSQL, getDeleteTargets, getDelimitedCase, getDelimitIdentifiers, getDouble, getDropColumnSQL, getDropForeignKeySQL, getDropIndexSQL, getDropPrimaryKeySQL, getDropSequenceSQL, getDropTableSQL, getFloat, getForeignKeyConstraintSQL, getForUpdateClause, getFrom, getFromSelect, getFullIdentifier, getFullName, getFullName, getGeneratedKey, getGeneratedKeySequenceName, getIdentifierConcatenator, getIdentifierDelimiter, getIdentifierRule, getIdentifierRules, getImportedKeys, getImportedKeys, getImportedKeys, getImportedKeys, getIndexInfo, getIndexInfo, getInt, getInvalidColumnWordSet, getJDBCType, getJDBCType, getJDBCType, getKey, getLeadingDelimiter, getLocale, getLog, getLong, getNamingUtil, getNumber, getObject, getPlaceholderValueString, getPreferredType, getPrimaryKeyConstraintSQL, getPrimaryKeys, getPrimaryKeys, getPrimaryKeysFromBestRowIdentifier, getPrimaryKeysFromBestRowIdentifier, getPrimaryKeysFromGetPrimaryKeys, getPrimaryKeysFromGetPrimaryKeys, getRef, getSchemaNameForMetadata, getSchemaNameForMetadata, getSelectOperation, getSelects, getSelectTableAliases, getSequence, getSequences, getSequences, getSequencesSQL, getSequencesSQL, getShort, getString, getSupportsDelimitedIdentifiers, getSupportsXMLColumn, getTableNameForMetadata, getTableNameForMetadata, getTables, getTables, getTime, getTimestamp, getTrailingDelimiter, getTrimSchemaName, getTypeName, getTypeName, getUniqueConstraintSQL, getValidColumnName, getValidColumnName, getValidColumnName, getValidColumnName, getValidForeignKeyName, getValidForeignKeyName, getValidIndexName, getValidIndexName, getValidPrimaryKeyName, getValidSequenceName, getValidSequenceName, getValidTableName, getValidTableName, getValidUniqueName, getValidUniqueName, getVersionColumn, getVersionColumn, getWhere, getXMLTypeEncoding, handleWarning, insertBlobForStreamingLoad, insertClobForStreamingLoad, insertSize, isSelect, isSystemIndex, isSystemIndex, isSystemSequence, isSystemSequence, isSystemTable, isSystemTable, makeNameValid, makeNameValid, makeNameValid, makeNameValid, matchErrorState, mathFunction, needsToCreateIndex, newColumn, newForeignKey, newIndex, newPrimaryKey, newSequence, newStoreException, newTable, prepareStatement, putBytes, putChars, putString, refSchemaComponents, serialize, setArray, setAsciiStream, setBatchLimit, setBigDecimal, setBigInteger, setBinaryStream, setBlob, setBlobObject, setBoolean, setByte, setBytes, setCalendar, setChar, setCharacterStream, setClob, setClobString, setConfiguration, setDate, setDate, setDefaultSchemaName, setDelimitedCase, setDelimitIdentifiers, setDouble, setFloat, setInt, setJoinSyntax, setLeadingDelimiter, setLocale, setLong, setNumber, setObject, setQueryTimeout, setRef, setShort, setStatementQueryTimeout, setString, setSupportsDelimitedIdentifiers, setTime, setTimeouts, setTimeouts, setTimestamp, setTrailingDelimiter, setTrimSchemaName, setTyped, setUnknown, setXMLTypeEncoding, shorten, startConfiguration, storageWarning, supportsDeferredForeignKeyConstraints, supportsDeferredUniqueConstraints, supportsDeleteAction, supportsIsolationForUpdate, supportsLocking, supportsRandomAccessResultSet, supportsUpdateAction, toBulkOperation, toDBName, toDBName, toDelete, toNativeJoin, toOperation, toOperation, toSelect, toSelect, toSelect, toSelect, toSelect, toSelectCount, toSQL92Join, toTraditionalJoin, toUpdate, updateBlob, updateClob, validateBatchProcess, validateDBSpecificBatchProcess
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VENDOR_MICROSOFT

public static final String VENDOR_MICROSOFT
See Also:
Constant Field Values

VENDOR_NETDIRECT

public static final String VENDOR_NETDIRECT
See Also:
Constant Field Values

VENDOR_JTDS

public static final String VENDOR_JTDS
See Also:
Constant Field Values

uniqueIdentifierAsVarbinary

public boolean uniqueIdentifierAsVarbinary
Flag whether to treat UNIQUEIDENTIFIER as VARBINARY or VARCHAR

Constructor Detail

SQLServerDictionary

public SQLServerDictionary()
Method Detail

connectedConfiguration

public void connectedConfiguration(Connection conn)
                            throws SQLException
Description copied from class: DBDictionary
This method is called when the dictionary first sees any connection. It is used to initialize dictionary metadata if needed. If you override this method, be sure to call super.connectedConfiguration.

Overrides:
connectedConfiguration in class DBDictionary
Throws:
SQLException

getColumns

public Column[] getColumns(DatabaseMetaData meta,
                           String catalog,
                           String schemaName,
                           String tableName,
                           String columnName,
                           Connection conn)
                    throws SQLException
Description copied from class: DBDictionary
Reflect on the schema to find columns matching the given table and column patterns.

Overrides:
getColumns in class AbstractSQLServerDictionary
Throws:
SQLException

getColumns

public Column[] getColumns(DatabaseMetaData meta,
                           DBIdentifier catalog,
                           DBIdentifier schemaName,
                           DBIdentifier tableName,
                           DBIdentifier columnName,
                           Connection conn)
                    throws SQLException
Description copied from class: DBDictionary
Reflect on the schema to find columns matching the given table and column patterns.

Overrides:
getColumns in class DBDictionary
Throws:
SQLException

appendLength

protected void appendLength(SQLBuffer buf,
                            int type)
Overrides:
appendLength in class DBDictionary

appendXmlComparison

public void appendXmlComparison(SQLBuffer buf,
                                String op,
                                FilterValue lhs,
                                FilterValue rhs,
                                boolean lhsxml,
                                boolean rhsxml)
If this dictionary supports XML type, use this method to append xml predicate.

Overrides:
appendXmlComparison in class DBDictionary
Parameters:
buf - the SQL buffer to write the comparison
op - the comparison operation to perform
lhs - the left hand side of the comparison
rhs - the right hand side of the comparison
lhsxml - indicates whether the left operand maps to xml
rhsxml - indicates whether the right operand maps to xml

getSchemaCase

public String getSchemaCase()
Return DB specific schemaCase

Specified by:
getSchemaCase in interface IdentifierConfiguration
Overrides:
getSchemaCase in class DBDictionary
Returns:
upper, lower, or preserve

setSupportsXMLColumn

public void setSupportsXMLColumn(boolean b)
Overrides:
setSupportsXMLColumn in class DBDictionary
Parameters:
b - boolean representing if XML columns are supported

isFatalException

public boolean isFatalException(int subtype,
                                SQLException ex)
Description copied from class: DBDictionary
Determine if the given SQL Exception is fatal or recoverable (such as a timeout). This implementation always returns true (i.e. all exceptions are fatal). The current dictionary implementation can overwrite this method to mark certain exception conditions as recoverable error.

Overrides:
isFatalException in class DBDictionary
Parameters:
subtype - A constant indicating the category of error as defined in StoreException.
ex - original SQL Exception as raised by the database driver.
Returns:
false if the error is fatal.

getLOBStream

public InputStream getLOBStream(JDBCStore store,
                                ResultSet rs,
                                int column)
                         throws SQLException
Obtain an InputStream by using ResultSet.getBlob(int) and Blob.getBinaryStream(). Unfortunately this will load entire BLOB into memory. The alternative ResultSet.getBinaryStream(int) provides true streaming but the stream can be consumed only as long as ResultSet is open.

Overrides:
getLOBStream in class DBDictionary
Throws:
SQLException

getCharacterStream

public Reader getCharacterStream(ResultSet rs,
                                 int column)
                          throws SQLException
Obtain a Reader by using ResultSet.getClob(int) and Clob.getCharacterStream(). Unfortunately this will load entire CLOB into memory. The alternative ResultSet.getCharacterStream(int) provides true streaming but the stream can be consumed only as long as ResultSet is open.

Overrides:
getCharacterStream in class DBDictionary
Throws:
SQLException


Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.