Package simpleorm.drivers
Class SDriverMSSQL
- java.lang.Object
- 
- simpleorm.sessionjdbc.SDriver
- 
- simpleorm.drivers.SDriverMSSQL
 
 
- 
 public class SDriverMSSQL extends SDriver This contains MS SQL Server specific code.CHAR, VARCHAR max 8,000. TEXT 2^31. NVARCHAR/NCHAR UTF16, max size 4,000. 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class simpleorm.sessionjdbc.SDriverSDriver.OffsetStrategy
 
- 
 - 
Constructor SummaryConstructors Constructor Description SDriverMSSQL()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringalterTableAddColumnSQL(SFieldScalar field)These alow you to create a new SFieldMeta object at runtime and then update the table to include it.protected java.lang.StringcolumnTypeSQL(SFieldScalar field, java.lang.String defalt)Apparently need DATETIME instead of TIMESTAMPprotected java.lang.StringdriverName()The driver name to be compared to getMetaData().getDriverName()protected java.lang.StringforUpdateSQL(boolean forUpdate)Returns update clause, may not be valid in certain lock modes etc.booleangetXLockEnabled()protected java.lang.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
 
- 
 
- 
- 
- 
Method Detail- 
driverNameprotected java.lang.String driverName() Description copied from class:SDriverThe driver name to be compared to getMetaData().getDriverName()- Overrides:
- driverNamein class- SDriver
 
 - 
columnTypeSQLprotected java.lang.String columnTypeSQL(SFieldScalar field, java.lang.String defalt) Apparently need DATETIME instead of TIMESTAMP- Overrides:
- columnTypeSQLin class- SDriver
 
 - 
forUpdateSQLprotected java.lang.String forUpdateSQL(boolean forUpdate) Description 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
 
 - 
postFromSQLprotected java.lang.String postFromSQL(boolean forUpdate) It 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:
- for discussion.
 
 - 
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() 
 - 
alterTableAddColumnSQLpublic java.lang.String alterTableAddColumnSQL(SFieldScalar field) Description 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
 
 
- 
 
-