public class DBMSHandlerMSSQL extends DBMSHandlerBase
| Modifier and Type | Class and Description |
|---|---|
static class |
DBMSHandlerMSSQL.DBCommandMSSQL
Provides a DBCommand implementation for Microsoft SQL-Server
|
static class |
DBMSHandlerMSSQL.DBSQLBuilderMSSQL
Provides a DBSQLBuilder implementation for Microsoft SQL-Server
|
DBMSHandlerBase.DBMSBuilder, DBMSHandlerBase.DBMSCommand, DBMSHandlerBase.DBSeqTableDBMSHandler.DBSetGenKeys| Modifier and Type | Field and Description |
|---|---|
protected DBDDLGenerator<?> |
ddlGenerator |
protected static String[] |
MSSQL_SQL_KEYWORDS |
GENERAL_SQL_KEYWORDS, ILLEGAL_NAME_CHARS, reservedSQLKeywords, SEQUENCE_NAME_SUFFIX| Constructor and Description |
|---|
DBMSHandlerMSSQL()
Constructor for the MSSQL database dbms.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addStatementParam(PreparedStatement pstmt,
int paramIndex,
Object value)
Adds special behaviour for Timestamp columns with are declared as DATETIME
|
void |
appendEnableRelationStmt(DBRelation r,
boolean enable,
DBSQLScript script)
Appends a statement to enable or disable a foreign key relation.
|
void |
attachDatabase(DBDatabase db,
Connection conn)
Called when a database is opened
|
boolean |
checkExists(DBDatabase db,
Connection conn)
checks if the database exists
The default implementation performs a simple count query on the first table or view
SELECT count(*) FROM table
|
DBCommand |
createCommand(boolean autoPrepareStmt)
Creates a new Microsoft SQL-Server command object.
|
DBModelChecker |
createModelChecker(DBDatabase db)
Creates a DataModelChecker instance of this DBMSHandler
|
DBModelParser |
createModelParser(String catalog,
String schema)
Creates a DataModelChecker instance of this DBMSHandler
|
DBSQLBuilder |
createSQLBuilder()
Creates a new Microsoft SQL-Server SQL-Builder.
|
Object |
getColumnAutoValue(DBDatabase db,
DBTableColumn column,
Connection conn)
Returns an auto-generated value for a particular column
|
String |
getConvertPhrase(DataType destType,
DataType srcType,
Object format)
Returns a data type convertion phrase template for this dbms
The returned template must contain a '?' |
String |
getDatabaseName() |
void |
getDDLScript(DBDDLGenerator.DDLActionType type,
DBObject dbo,
DBSQLScript script)
Appends the required DLL commands to create, drop or alter an object to the supplied DBDQLScript.
|
Object |
getNextSequenceValue(DBDatabase db,
String seqName,
int minValue,
Connection conn)
Returns the next value of a named sequence The numbers are used for fields of type DBExpr.DT_AUTOINC.
|
DBColumnExpr |
getNextSequenceValueExpr(DBTableColumn column)
Returns an expression for creating a sequence value.
|
String |
getObjectOwner() |
String |
getSequenceTableName()
returns the name of the sequence table
|
String |
getSQLPhrase(DBSqlPhrase phrase)
Gets an sql phrase template for this database system.
|
Timestamp |
getUpdateTimestamp(Connection conn)
Overridden.
|
boolean |
isSupported(DBMSFeature type)
Returns whether or not a particular feature is supported by this dbms
|
boolean |
isUseDateTime2()
returns whether the DATETIME2 datatype is used for timestamps (instead of DATETIME)
|
boolean |
isUseSequenceTable()
returns whether a sequence table is used for record identiy management.
|
boolean |
isUseUnicodePrefix()
Indicates whether or not a Unicode Prefix (N) is prepended to all text values
|
void |
setDatabaseName(String databaseName) |
void |
setObjectOwner(String objectOwner) |
void |
setSequenceTableName(String sequenceTableName)
Sets the name of the sequence table.
|
void |
setUseDateTime2(boolean useDateTime2)
Sets whether or not to use the DATETIME2 datatype instead of DATETIME for timestamps
Default is true (set to false for existing databases using DATETIME!)
|
void |
setUseSequenceTable(boolean useSequenceTable)
If set to true a special table is used for sequence number generation.
|
void |
setUseUnicodePrefix(boolean useUnicodePrefix)
Sets whether or not to use a Unicode Prefix (N) for all text values
Default is true
|
appendObjectName, closeResultSet, closeStatement, createCombinedCommand, detachDatabase, detectQuoteName, executeBatch, executeQuery, executeSQL, extractErrorMessage, getColumnSequenceName, getResultValue, prepareStatement, querySingleValueprotected DBDDLGenerator<?> ddlGenerator
protected static final String[] MSSQL_SQL_KEYWORDS
public DBMSHandlerMSSQL()
public String getDatabaseName()
public void setDatabaseName(String databaseName)
public String getObjectOwner()
public void setObjectOwner(String objectOwner)
public boolean isUseSequenceTable()
public void setUseSequenceTable(boolean useSequenceTable)
useSequenceTable - true to use a sequence table or false otherwise.public String getSequenceTableName()
public void setSequenceTableName(String sequenceTableName)
sequenceTableName - the name of the table used for sequence number generationpublic boolean isUseUnicodePrefix()
public void setUseUnicodePrefix(boolean useUnicodePrefix)
useUnicodePrefix - true if a Unicode Prefix (N) should be used for text valuespublic boolean isUseDateTime2()
public void setUseDateTime2(boolean useDateTime2)
useDateTime2 - true if DATETIME2 or false if DATETIME is usedpublic boolean checkExists(DBDatabase db, Connection conn)
checkExists in interface DBMSHandlercheckExists in class DBMSHandlerBasedb - the databaseconn - the Jdbc connectionpublic void attachDatabase(DBDatabase db, Connection conn)
attachDatabase in interface DBMSHandlerattachDatabase in class DBMSHandlerBasedb - the databaseconn - the Jdbc connectionpublic DBCommand createCommand(boolean autoPrepareStmt)
createCommand in interface DBMSHandlercreateCommand in class DBMSHandlerBaseautoPrepareStmt - flag whether to automatically provide literal values as prepared statement paramspublic DBSQLBuilder createSQLBuilder()
createSQLBuilder in interface DBMSHandlercreateSQLBuilder in class DBMSHandlerBasepublic boolean isSupported(DBMSFeature type)
isSupported in interface DBMSHandlerisSupported in class DBMSHandlerBasetype - type of requested feature. @see DBMSFeaturepublic String getSQLPhrase(DBSqlPhrase phrase)
phrase - the identifier of the phraseDBMSHandler.getSQLPhrase(DBSqlPhrase)public String getConvertPhrase(DataType destType, DataType srcType, Object format)
DBMSHandlerdestType - the target data typesrcType - the source data typeformat - additional formatting information (optional)DBMSHandler.getConvertPhrase(DataType, DataType, Object)public Object getNextSequenceValue(DBDatabase db, String seqName, int minValue, Connection conn)
DBMSHandlerBasegetNextSequenceValue in class DBMSHandlerBasedb - the databaseseqName - the name of the sequenceminValue - the minimum value of the sequenceconn - a valid database connectionDBMSHandlerBase.getNextSequenceValue(DBDatabase, String, int, Connection)public DBColumnExpr getNextSequenceValueExpr(DBTableColumn column)
DBMSHandlerBasegetNextSequenceValueExpr in class DBMSHandlerBasecolumn - the column for which to obtain an expression providing the next sequence valueDBMSHandlerBase.getNextSequenceValueExpr(DBTableColumn col)public Timestamp getUpdateTimestamp(Connection conn)
getUpdateTimestamp in interface DBMSHandlergetUpdateTimestamp in class DBMSHandlerBaseconn - the connection that might be usedpublic Object getColumnAutoValue(DBDatabase db, DBTableColumn column, Connection conn)
getColumnAutoValue in interface DBMSHandlergetColumnAutoValue in class DBMSHandlerBasedb - the databasecolumn - the column for which a value is requiredconn - a valid database connectionprotected void addStatementParam(PreparedStatement pstmt, int paramIndex, Object value) throws SQLException
addStatementParam in class DBMSHandlerBasepstmt - the prepared statementparamIndex - the parameter indexvalue - the parameter valueSQLException - thrown if a database access error occurspublic void getDDLScript(DBDDLGenerator.DDLActionType type, DBObject dbo, DBSQLScript script)
DBMSHandlertype - operation to perform (CREATE, DROP, ALTER)dbo - the object for which to perform the operation (DBDatabase, DBTable, DBView, DBColumn, DBRelation)script - the script to which to add the DDL command(s)DBMSHandler#getDDLScript(DDLActionType, DBObject, DBSQLScript)public void appendEnableRelationStmt(DBRelation r, boolean enable, DBSQLScript script)
DBMSHandlerBaseappendEnableRelationStmt in interface DBMSHandlerappendEnableRelationStmt in class DBMSHandlerBaser - the foreign key relation which should be enabled or disabledenable - true to enable the relation or false to disablescript - the script to which to add the DDL command(s)DBMSHandler.appendEnableRelationStmt(DBRelation, boolean, DBSQLScript)public DBModelParser createModelParser(String catalog, String schema)
createModelParser in interface DBMSHandlercreateModelParser in class DBMSHandlerBasecatalog - the database catalogschema - the database schemapublic DBModelChecker createModelChecker(DBDatabase db)
DBMSHandlerBasecreateModelChecker in interface DBMSHandlercreateModelChecker in class DBMSHandlerBasedb - the databaseCopyright © 2008–2023 Apache Software Foundation. All rights reserved.