Package tilda.db.stores
Class MSSQL
- java.lang.Object
-
- tilda.db.stores.MSSQL
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String[]
_LOCK_CONN_ERROR_SUBSTR
protected static java.lang.String[]
_NODATA_SQL_STATES
protected static CodeGenSql
_SQL
-
Constructor Summary
Constructors Constructor Description MSSQL()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
age(Connection C, java.lang.StringBuilder Str, Type_DatetimePrimitive ColStart, Type_DatetimePrimitive ColEnd, DurationUtil.IntervalEnum Type, int Count, java.lang.String Operator)
boolean
alterTableAddColumn(Connection Con, Column Col, java.lang.String DefaultValue, java.lang.String temporaryDefaultValue)
boolean
alterTableAddFK(Connection Con, ForeignKey FK)
boolean
alterTableAddIndex(Connection Con, Index IX)
java.lang.String
alterTableAddIndexDDL(Index IX)
boolean
alterTableAlterColumnComment(Connection C, Column Col)
boolean
alterTableAlterColumnDefault(Connection Con, Column Col)
boolean
alterTableAlterColumnMulti(Connection Con, java.util.List<ColMetaColPair> BatchTypeCols, java.util.List<ColMetaColPair> BatchSizeCols, ZoneInfo_Data defaultZI)
boolean
alterTableAlterColumnNull(Connection Con, Column Col, java.lang.String DefaultValue)
boolean
alterTableAlterColumnNumericSize(Connection connection, ColumnMeta colMeta, Column col)
boolean
alterTableAlterColumnStringSize(Connection Con, ColumnMeta ColMeta, Column Col)
boolean
alterTableAlterColumnType(Connection Con, ColumnMeta ColMeta, Column Col, ZoneInfo_Data defaultZI)
boolean
alterTableComment(Connection C, Object Obj)
boolean
alterTableDropColumn(Connection Con, Object Obj, java.lang.String ColumnName)
boolean
alterTableDropFK(Connection Con, Object Obj, FKMeta FK)
boolean
alterTableDropIndex(Connection Con, Object Obj, IndexMeta IX)
boolean
alterTableIndexAddCluster(Connection Con, Index IX)
boolean
alterTableIndexDropCluster(Connection Con, IndexMeta IX)
boolean
alterTableRenameIndex(Connection Con, Object Obj, java.lang.String OldName, java.lang.String NewName)
boolean
alterTableReplaceTablePK(Connection Con, Object Obj, PKMeta oldPK)
void
cancel(Connection C)
boolean
createKeysEntry(Connection Con, Object Obj)
boolean
createSchema(Connection Con, Schema S)
boolean
createTable(Connection Con, Object Obj)
boolean
createView(Connection Con, View V)
boolean
dropView(Connection con, ViewMeta v, boolean cascade)
boolean
dropView(Connection Con, View V)
boolean
fullIdentifierOnUpdate()
java.lang.String
getAclRolesScript(Connection Con, java.util.List<Schema> TildaList)
java.lang.String
getAggregateStr(AggregateType AT)
java.lang.String
getBackendConnectionId(Connection connection)
char
getColumnQuotingEndChar()
char
getColumnQuotingStartChar()
void
getColumnType(java.lang.StringBuilder Str, ColumnType T, java.lang.Integer S, ColumnMode M, boolean Collection, java.lang.Integer Precision, java.lang.Integer Scale)
java.lang.String
getColumnType(ColumnType T, java.lang.Integer S, ColumnMode M, boolean Collection)
java.lang.String
getColumnType(Column C)
java.lang.String
getColumnType(Column C, ColumnType AggregateType)
java.lang.String
getColumnTypeRaw(ColumnType Type, int Size, boolean isArray)
java.lang.String
getColumnTypeRaw(Column C, boolean MultiOverride)
java.lang.String[]
getConnectionCancelStates()
java.lang.String[]
getConnectionLockMsgs()
java.lang.String[]
getConnectionNoDataStates()
java.time.LocalDate
getCurrentDate(Connection con)
java.lang.String
getCurrentDateStr()
java.time.ZonedDateTime
getCurrentDateTime(Connection con)
java.lang.String
getCurrentDateTimeStr()
java.time.ZonedDateTime
getCurrentTimestamp(Connection con)
java.lang.String
getCurrentTimestampStr()
DBStringType
getDBStringType(int Size)
void
getFullColumnVar(java.lang.StringBuilder Str, java.lang.String SchemaName, java.lang.String TableName, java.lang.String ColumnName)
java.lang.String
getFullColumnVar(Column C)
java.lang.String
getFullColumnVar(Column C, int i)
void
getFullTableVar(java.lang.StringBuilder Str, java.lang.String SchemaName, java.lang.String TableName)
java.lang.String
getFullTableVar(Object O)
java.lang.String
getFullTableVar(Object O, int i)
java.lang.String
getHelperFunctionsScript(Connection Con, boolean Start)
java.lang.String
getJsonParametrizedQueryPlaceHolder()
int
getMaxColumnNameSize()
int
getMaxTableNameSize()
java.lang.String
getName()
java.lang.String
getSelectLimitClause(int Start, int Size)
java.lang.String
getShortColumnVar(java.lang.String name)
java.lang.String
getShortColumnVar(Column C)
CodeGenSql
getSQlCodeGen()
StringStringPair
getTypeMapping(int Type, java.lang.String Name, int Size, java.lang.String TypeName)
boolean
isCaseSentitiveSchemaTableViewNames()
boolean
isSuperUser(Connection C)
boolean
moveTableView(Connection con, Base base, java.lang.String oldSchemaName)
boolean
needsSavepoint()
boolean
renameTableColumn(Connection con, Column col, java.lang.String oldName)
boolean
renameTableView(Connection con, Base base, java.lang.String oldName)
boolean
reorgTable(Connection con, java.lang.String schemaName, java.lang.String tableName, java.lang.String clusterIndexName, boolean verbose, boolean full)
java.lang.String
rewriteExpressionColumnQuoting(java.lang.String expr)
void
setArray(Connection C, java.sql.PreparedStatement PS, int i, ColumnType Type, java.util.List<java.sql.Array> allocatedArrays, java.util.Collection<?> val)
void
setOrderByWithNullsOrdering(Connection C, java.lang.StringBuilder Str, ColumnDefinition Col, boolean Asc, boolean NullsLast)
boolean
supportsArrays()
boolean
supportsFilterClause()
boolean
supportsFirstLastAggregates()
boolean
supportsForeignKeys()
boolean
supportsIndices()
boolean
supportsPrimaryKeys()
boolean
supportsReorg()
boolean
supportsSelectLimit()
boolean
supportsSelectOffset()
boolean
supportsSuperMetaDataQueries()
void
truncateTable(Connection C, java.lang.String schemaName, java.lang.String tableName, boolean cascade)
void
within(Connection C, java.lang.StringBuilder Str, Type_DatetimePrimitive Col, Type_DatetimePrimitive ColStart, long DurationCount, DurationUtil.IntervalEnum DurationType)
-
-
-
Field Detail
-
_NODATA_SQL_STATES
protected static final java.lang.String[] _NODATA_SQL_STATES
-
_LOCK_CONN_ERROR_SUBSTR
protected static final java.lang.String[] _LOCK_CONN_ERROR_SUBSTR
-
_SQL
protected static CodeGenSql _SQL
-
-
Method Detail
-
getConnectionNoDataStates
public java.lang.String[] getConnectionNoDataStates()
- Specified by:
getConnectionNoDataStates
in interfaceDBType
-
getCurrentTimestampStr
public java.lang.String getCurrentTimestampStr()
- Specified by:
getCurrentTimestampStr
in interfaceDBType
- Returns:
- The string denoting the current timestamp with timezone statement, e.g., "statement_timestamp()" for Postgres, or "CURRENT_TIMESTAMP" for bigquery.
-
getCurrentDateTimeStr
public java.lang.String getCurrentDateTimeStr()
- Specified by:
getCurrentDateTimeStr
in interfaceDBType
- Returns:
- The string denoting the current timestamp without timezone statement, "statement_timestamp()::timestamp" for Postgres, or "CURRENT_DATETIME" for bigquery.
-
getCurrentDateTime
public java.time.ZonedDateTime getCurrentDateTime(Connection con) throws java.lang.Exception
- Specified by:
getCurrentDateTime
in interfaceDBType
- Throws:
java.lang.Exception
-
getCurrentTimestamp
public java.time.ZonedDateTime getCurrentTimestamp(Connection con) throws java.lang.Exception
- Specified by:
getCurrentTimestamp
in interfaceDBType
- Throws:
java.lang.Exception
-
getCurrentDate
public java.time.LocalDate getCurrentDate(Connection con) throws java.lang.Exception
- Specified by:
getCurrentDate
in interfaceDBType
- Throws:
java.lang.Exception
-
getConnectionLockMsgs
public java.lang.String[] getConnectionLockMsgs()
- Specified by:
getConnectionLockMsgs
in interfaceDBType
-
needsSavepoint
public boolean needsSavepoint()
- Specified by:
needsSavepoint
in interfaceDBType
-
supportsSelectLimit
public boolean supportsSelectLimit()
- Specified by:
supportsSelectLimit
in interfaceDBType
-
supportsSelectOffset
public boolean supportsSelectOffset()
- Specified by:
supportsSelectOffset
in interfaceDBType
-
supportsArrays
public boolean supportsArrays()
- Specified by:
supportsArrays
in interfaceDBType
-
supportsSuperMetaDataQueries
public boolean supportsSuperMetaDataQueries()
- Specified by:
supportsSuperMetaDataQueries
in interfaceDBType
-
getSelectLimitClause
public java.lang.String getSelectLimitClause(int Start, int Size)
- Specified by:
getSelectLimitClause
in interfaceDBType
-
getAggregateStr
public java.lang.String getAggregateStr(AggregateType AT)
- Specified by:
getAggregateStr
in interfaceDBType
-
fullIdentifierOnUpdate
public boolean fullIdentifierOnUpdate()
- Specified by:
fullIdentifierOnUpdate
in interfaceDBType
-
getSQlCodeGen
public CodeGenSql getSQlCodeGen()
- Specified by:
getSQlCodeGen
in interfaceDBType
-
createSchema
public boolean createSchema(Connection Con, Schema S) throws java.lang.Exception
- Specified by:
createSchema
in interfaceDBType
- Throws:
java.lang.Exception
-
createTable
public boolean createTable(Connection Con, Object Obj) throws java.lang.Exception
- Specified by:
createTable
in interfaceDBType
- Throws:
java.lang.Exception
-
createKeysEntry
public boolean createKeysEntry(Connection Con, Object Obj) throws java.lang.Exception
- Specified by:
createKeysEntry
in interfaceDBType
- Throws:
java.lang.Exception
-
dropView
public boolean dropView(Connection Con, View V) throws java.lang.Exception
-
createView
public boolean createView(Connection Con, View V) throws java.lang.Exception
- Specified by:
createView
in interfaceDBType
- Throws:
java.lang.Exception
-
getColumnType
public java.lang.String getColumnType(ColumnType T, java.lang.Integer S, ColumnMode M, boolean Collection)
-
alterTableAddColumn
public boolean alterTableAddColumn(Connection Con, Column Col, java.lang.String DefaultValue, java.lang.String temporaryDefaultValue) throws java.lang.Exception
- Specified by:
alterTableAddColumn
in interfaceDBType
- Throws:
java.lang.Exception
-
alterTableDropColumn
public boolean alterTableDropColumn(Connection Con, Object Obj, java.lang.String ColumnName) throws java.lang.Exception
- Specified by:
alterTableDropColumn
in interfaceDBType
- Throws:
java.lang.Exception
-
alterTableAlterColumnNull
public boolean alterTableAlterColumnNull(Connection Con, Column Col, java.lang.String DefaultValue) throws java.lang.Exception
- Specified by:
alterTableAlterColumnNull
in interfaceDBType
- Throws:
java.lang.Exception
-
getDBStringType
public DBStringType getDBStringType(int Size)
- Specified by:
getDBStringType
in interfaceDBType
-
alterTableAlterColumnNumericSize
public boolean alterTableAlterColumnNumericSize(Connection connection, ColumnMeta colMeta, Column col) throws java.lang.Exception
- Specified by:
alterTableAlterColumnNumericSize
in interfaceDBType
- Throws:
java.lang.Exception
-
alterTableAlterColumnStringSize
public boolean alterTableAlterColumnStringSize(Connection Con, ColumnMeta ColMeta, Column Col) throws java.lang.Exception
- Specified by:
alterTableAlterColumnStringSize
in interfaceDBType
- Throws:
java.lang.Exception
-
alterTableAlterColumnType
public boolean alterTableAlterColumnType(Connection Con, ColumnMeta ColMeta, Column Col, ZoneInfo_Data defaultZI)
- Specified by:
alterTableAlterColumnType
in interfaceDBType
-
alterTableAlterColumnMulti
public boolean alterTableAlterColumnMulti(Connection Con, java.util.List<ColMetaColPair> BatchTypeCols, java.util.List<ColMetaColPair> BatchSizeCols, ZoneInfo_Data defaultZI)
- Specified by:
alterTableAlterColumnMulti
in interfaceDBType
-
getHelperFunctionsScript
public java.lang.String getHelperFunctionsScript(Connection Con, boolean Start) throws java.lang.Exception
- Specified by:
getHelperFunctionsScript
in interfaceDBType
- Throws:
java.lang.Exception
-
getTypeMapping
public StringStringPair getTypeMapping(int Type, java.lang.String Name, int Size, java.lang.String TypeName) throws java.lang.Exception
- Specified by:
getTypeMapping
in interfaceDBType
- Throws:
java.lang.Exception
-
getFullColumnVar
public void getFullColumnVar(java.lang.StringBuilder Str, java.lang.String SchemaName, java.lang.String TableName, java.lang.String ColumnName)
- Specified by:
getFullColumnVar
in interfaceDBType
-
getFullTableVar
public void getFullTableVar(java.lang.StringBuilder Str, java.lang.String SchemaName, java.lang.String TableName)
- Specified by:
getFullTableVar
in interfaceDBType
-
getColumnType
public void getColumnType(java.lang.StringBuilder Str, ColumnType T, java.lang.Integer S, ColumnMode M, boolean Collection, java.lang.Integer Precision, java.lang.Integer Scale)
- Specified by:
getColumnType
in interfaceDBType
-
setArray
public void setArray(Connection C, java.sql.PreparedStatement PS, int i, ColumnType Type, java.util.List<java.sql.Array> allocatedArrays, java.util.Collection<?> val) throws java.lang.Exception
-
getJsonParametrizedQueryPlaceHolder
public java.lang.String getJsonParametrizedQueryPlaceHolder()
- Specified by:
getJsonParametrizedQueryPlaceHolder
in interfaceDBType
-
setOrderByWithNullsOrdering
public void setOrderByWithNullsOrdering(Connection C, java.lang.StringBuilder Str, ColumnDefinition Col, boolean Asc, boolean NullsLast)
- Specified by:
setOrderByWithNullsOrdering
in interfaceDBType
-
truncateTable
public void truncateTable(Connection C, java.lang.String schemaName, java.lang.String tableName, boolean cascade) throws java.lang.Exception
- Specified by:
truncateTable
in interfaceDBType
- Throws:
java.lang.Exception
-
age
public void age(Connection C, java.lang.StringBuilder Str, Type_DatetimePrimitive ColStart, Type_DatetimePrimitive ColEnd, DurationUtil.IntervalEnum Type, int Count, java.lang.String Operator)
-
alterTableComment
public boolean alterTableComment(Connection C, Object Obj)
- Specified by:
alterTableComment
in interfaceDBType
-
alterTableAlterColumnComment
public boolean alterTableAlterColumnComment(Connection C, Column Col)
- Specified by:
alterTableAlterColumnComment
in interfaceDBType
-
within
public void within(Connection C, java.lang.StringBuilder Str, Type_DatetimePrimitive Col, Type_DatetimePrimitive ColStart, long DurationCount, DurationUtil.IntervalEnum DurationType)
-
getAclRolesScript
public java.lang.String getAclRolesScript(Connection Con, java.util.List<Schema> TildaList) throws java.lang.Exception
- Specified by:
getAclRolesScript
in interfaceDBType
- Throws:
java.lang.Exception
-
alterTableReplaceTablePK
public boolean alterTableReplaceTablePK(Connection Con, Object Obj, PKMeta oldPK) throws java.lang.Exception
- Specified by:
alterTableReplaceTablePK
in interfaceDBType
- Throws:
java.lang.Exception
-
alterTableDropFK
public boolean alterTableDropFK(Connection Con, Object Obj, FKMeta FK) throws java.lang.Exception
- Specified by:
alterTableDropFK
in interfaceDBType
- Throws:
java.lang.Exception
-
alterTableAddFK
public boolean alterTableAddFK(Connection Con, ForeignKey FK) throws java.lang.Exception
- Specified by:
alterTableAddFK
in interfaceDBType
- Throws:
java.lang.Exception
-
alterTableDropIndex
public boolean alterTableDropIndex(Connection Con, Object Obj, IndexMeta IX) throws java.lang.Exception
- Specified by:
alterTableDropIndex
in interfaceDBType
- Throws:
java.lang.Exception
-
alterTableAddIndex
public boolean alterTableAddIndex(Connection Con, Index IX) throws java.lang.Exception
- Specified by:
alterTableAddIndex
in interfaceDBType
- Throws:
java.lang.Exception
-
alterTableIndexDropCluster
public boolean alterTableIndexDropCluster(Connection Con, IndexMeta IX) throws java.lang.Exception
- Specified by:
alterTableIndexDropCluster
in interfaceDBType
- Throws:
java.lang.Exception
-
alterTableIndexAddCluster
public boolean alterTableIndexAddCluster(Connection Con, Index IX) throws java.lang.Exception
- Specified by:
alterTableIndexAddCluster
in interfaceDBType
- Throws:
java.lang.Exception
-
alterTableRenameIndex
public boolean alterTableRenameIndex(Connection Con, Object Obj, java.lang.String OldName, java.lang.String NewName) throws java.lang.Exception
- Specified by:
alterTableRenameIndex
in interfaceDBType
- Throws:
java.lang.Exception
-
isSuperUser
public boolean isSuperUser(Connection C) throws java.lang.Exception
- Specified by:
isSuperUser
in interfaceDBType
- Throws:
java.lang.Exception
-
getMaxColumnNameSize
public int getMaxColumnNameSize()
- Specified by:
getMaxColumnNameSize
in interfaceDBType
-
getMaxTableNameSize
public int getMaxTableNameSize()
- Specified by:
getMaxTableNameSize
in interfaceDBType
-
alterTableAddIndexDDL
public java.lang.String alterTableAddIndexDDL(Index IX) throws java.lang.Exception
- Specified by:
alterTableAddIndexDDL
in interfaceDBType
- Throws:
java.lang.Exception
-
alterTableAlterColumnDefault
public boolean alterTableAlterColumnDefault(Connection Con, Column Col) throws java.lang.Exception
- Specified by:
alterTableAlterColumnDefault
in interfaceDBType
- Throws:
java.lang.Exception
-
getBackendConnectionId
public java.lang.String getBackendConnectionId(Connection connection) throws java.lang.Exception
- Specified by:
getBackendConnectionId
in interfaceDBType
- Throws:
java.lang.Exception
-
cancel
public void cancel(Connection C) throws java.sql.SQLException
-
getCurrentDateStr
public java.lang.String getCurrentDateStr()
- Specified by:
getCurrentDateStr
in interfaceDBType
-
dropView
public boolean dropView(Connection con, ViewMeta v, boolean cascade) throws java.lang.Exception
-
renameTableView
public boolean renameTableView(Connection con, Base base, java.lang.String oldName) throws java.lang.Exception
- Specified by:
renameTableView
in interfaceDBType
- Throws:
java.lang.Exception
-
renameTableColumn
public boolean renameTableColumn(Connection con, Column col, java.lang.String oldName) throws java.lang.Exception
- Specified by:
renameTableColumn
in interfaceDBType
- Throws:
java.lang.Exception
-
moveTableView
public boolean moveTableView(Connection con, Base base, java.lang.String oldSchemaName) throws java.lang.Exception
- Specified by:
moveTableView
in interfaceDBType
- Throws:
java.lang.Exception
-
supportsFilterClause
public boolean supportsFilterClause()
- Specified by:
supportsFilterClause
in interfaceDBType
-
supportsPrimaryKeys
public boolean supportsPrimaryKeys()
- Specified by:
supportsPrimaryKeys
in interfaceDBType
-
supportsForeignKeys
public boolean supportsForeignKeys()
- Specified by:
supportsForeignKeys
in interfaceDBType
-
supportsIndices
public boolean supportsIndices()
- Specified by:
supportsIndices
in interfaceDBType
-
getColumnQuotingStartChar
public char getColumnQuotingStartChar()
- Specified by:
getColumnQuotingStartChar
in interfaceDBType
-
getColumnQuotingEndChar
public char getColumnQuotingEndChar()
- Specified by:
getColumnQuotingEndChar
in interfaceDBType
-
getConnectionCancelStates
public java.lang.String[] getConnectionCancelStates()
- Specified by:
getConnectionCancelStates
in interfaceDBType
-
getFullTableVar
public java.lang.String getFullTableVar(Object O)
- Specified by:
getFullTableVar
in interfaceDBType
-
getFullTableVar
public java.lang.String getFullTableVar(Object O, int i)
- Specified by:
getFullTableVar
in interfaceDBType
-
getShortColumnVar
public java.lang.String getShortColumnVar(Column C)
- Specified by:
getShortColumnVar
in interfaceDBType
-
getFullColumnVar
public java.lang.String getFullColumnVar(Column C)
- Specified by:
getFullColumnVar
in interfaceDBType
-
getFullColumnVar
public java.lang.String getFullColumnVar(Column C, int i)
- Specified by:
getFullColumnVar
in interfaceDBType
-
getColumnType
public java.lang.String getColumnType(Column C)
- Specified by:
getColumnType
in interfaceDBType
-
getColumnType
public java.lang.String getColumnType(Column C, ColumnType AggregateType)
- Specified by:
getColumnType
in interfaceDBType
-
getColumnTypeRaw
public java.lang.String getColumnTypeRaw(Column C, boolean MultiOverride)
- Specified by:
getColumnTypeRaw
in interfaceDBType
-
getColumnTypeRaw
public java.lang.String getColumnTypeRaw(ColumnType Type, int Size, boolean isArray)
- Specified by:
getColumnTypeRaw
in interfaceDBType
-
supportsFirstLastAggregates
public boolean supportsFirstLastAggregates()
- Specified by:
supportsFirstLastAggregates
in interfaceDBType
-
getShortColumnVar
public java.lang.String getShortColumnVar(java.lang.String name)
- Specified by:
getShortColumnVar
in interfaceDBType
-
rewriteExpressionColumnQuoting
public java.lang.String rewriteExpressionColumnQuoting(java.lang.String expr)
- Specified by:
rewriteExpressionColumnQuoting
in interfaceDBType
-
supportsReorg
public boolean supportsReorg()
- Specified by:
supportsReorg
in interfaceDBType
-
reorgTable
public boolean reorgTable(Connection con, java.lang.String schemaName, java.lang.String tableName, java.lang.String clusterIndexName, boolean verbose, boolean full) throws java.lang.Exception
- Specified by:
reorgTable
in interfaceDBType
- Throws:
java.lang.Exception
-
isCaseSentitiveSchemaTableViewNames
public boolean isCaseSentitiveSchemaTableViewNames()
- Specified by:
isCaseSentitiveSchemaTableViewNames
in interfaceDBType
-
-