Package simpleorm.drivers
Class SDriverMSSQL
java.lang.Object
simpleorm.sessionjdbc.SDriver
simpleorm.drivers.SDriverMSSQL
This contains MS SQL Server specific code.
 
CHAR, VARCHAR max 8,000. TEXT 2^31. NVARCHAR/NCHAR UTF16, max size 4,000.
- 
Nested Class SummaryNested classes/interfaces inherited from class simpleorm.sessionjdbc.SDriverSDriver.OffsetStrategy
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionThese alow you to create a new SFieldMeta object at runtime and then update the table to include it.protected StringcolumnTypeSQL(SFieldScalar field, String defalt) Apparently need DATETIME instead of TIMESTAMPprotected StringThe driver name to be compared to getMetaData().getDriverName()protected StringforUpdateSQL(boolean forUpdate) Returns update clause, may not be valid in certain lock modes etc.booleanprotected StringpostFromSQL(boolean forUpdate) It is unclear how MS SQL 2005 does snapshot locking -- very complex, needs experimentation.voidsetXLockEnabled(boolean xlock) Enables WITH (XLOCK) for updatable queries.Methods inherited from class simpleorm.sessionjdbc.SDriveraddNull, alterTableDropColumnSQL, appendColumnName, appendQuotedIdentifier, appendQuotedIdentifier, appendTableName, clauseSeparator, createSequenceDDL, createTableSQL, deleteSQL, dropSequenceDDL, dropTableNoError, foreignKeysSQL, fromSQL, generateKeySelectMax, generateKeySequence, getLogger, getOffsetStrategy, getSession, indexKeySQL, insertSQL, joinSQL, limitSQL, makeForeignKeyIndexSQL, mapForeignKeys, maxIdentNameLength, postColumnSQL, postTablePostParenSQL, postTablePreParenSQL, primaryKeySQL, queryExecuteFactory, registerDriver, selectSQL, selectSQL, supportsKeySequences, supportsLocking, updateSQL, whereSQL, wholeColumnSQL
- 
Constructor Details- 
SDriverMSSQLpublic SDriverMSSQL()
 
- 
- 
Method Details- 
driverNameDescription copied from class:SDriverThe driver name to be compared to getMetaData().getDriverName()- Overrides:
- driverNamein class- SDriver
 
- 
columnTypeSQLApparently need DATETIME instead of TIMESTAMP- Overrides:
- columnTypeSQLin class- SDriver
 
- 
forUpdateSQLDescription copied from class:SDriverReturns update clause, may not be valid in certain lock modes etc. Right at the end of the query.Oracle, Postgresql, and new in MS SQL 2005 support data versioning or snapshots. This means that repeatable read is achieved by caching the previous value read instead of using read locks. This approach makes it critical to add FOR UPDATE where appropriate or there is effectively no locking. Indeed, in Oracle, you are guaranteed that several SELECTS will return the same value, but a subsequent SELECT FOR UPDATE in the same transaction may return a different value. - Overrides:
- forUpdateSQLin class- SDriver
 
- 
postFromSQLIt is unclear how MS SQL 2005 does snapshot locking -- very complex, needs experimentation. http://msdn.microsoft.com/en-us/library/ms345124.aspxNeed for XLOCK is unclear. However, Jorge says that it is unnecessary and makes SimpleORM fail, but it works for me. - Overrides:
- postFromSQLin class- SDriver
- See Also:
 
- 
setXLockEnabledpublic void setXLockEnabled(boolean xlock) Enables WITH (XLOCK) for updatable queries. Should reduce deadlocks but apparantly can cause bugs. (Not supported in SQL 7? Something about HOLDLOCK?)
- 
getXLockEnabledpublic boolean getXLockEnabled()
- 
alterTableAddColumnSQLDescription copied from class:SDriverThese alow you to create a new SFieldMeta object at runtime and then update the table to include it. Eg. for end user customizations. ## Ideally this could be further automated so that the SRecordMeta and JDBC meta data for a table could be compared and the table automatically altered.- Overrides:
- alterTableAddColumnSQLin class- SDriver
 
 
-