Package com.valqueries.automapper
Class MssqlSqlDialect
java.lang.Object
com.valqueries.automapper.MssqlSqlDialect
- All Implemented Interfaces:
SqlDialect
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddColumn
(TableToken tablename, ColumnToken columnName, String sqlType) boolean
allowsConversion
(Clazz<?> sqlType, String type) describe
(TableToken tablename) describeIndex
(TableToken tablename) escapeColumnOrTable
(String name) generateDeleteStatement
(String tableAlias, TableToken table, List<Element> elements, Integer limit) generateDropIndexStatement
(TableToken tableName, IndexToken index, boolean isPrimary) generateIndexOnCreateStatement
(TableToken tableName, KeySet keyset, boolean isUnique) generateIndexStatement
(TableToken tablename, KeySet key) generatePrimaryKeyStatement
(TableToken name, KeySet key) generateUpdateStatement
(TableToken table, List<Element> elements, List<Property.PropertyValue<?>> newPropertyValues, List<Property.PropertyValue<?>> incrementPropertyValues) <O> String
getCustomUpsert
(CompoundColumnizer<O> columnizer, Class<O> modelType, List<Property.PropertyValue<?>> newValues, List<Property.PropertyValue<?>> incrementValues, List<Property<?>> setObjValues, List<Property<?>> incrementByObjValues) getDescribeDbResult
(OrmResultSet ormResultSet) <O> String
getInsertAutoIncrement
(CompoundColumnizer<O> columnizer, Class<O> oClass, List<Boolean> keyNulls) getLimitDefinition
(int offset, int limit) getSqlType
(Property<?> property) <O> String
getUpsert
(CompoundColumnizer<O> columnizer, Class<O> oClass) <O> String
getUpsertAutoIncrement
(CompoundColumnizer<O> columnizer, Class<O> oClass, List<Boolean> keyNulls) groupConcat
(Property<?> resultProperty, String separator) harmonizeLikeValue
(Object value) Harmonize the value to be used in a LIKE statement.boolean
Check whether an exception was caused by a duplicate value for primary or unique key.boolean
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.valqueries.automapper.SqlDialect
_column, buildSelectSql, column, dropTableStatement, generateDeleteStatement, generateDistinctSelectStatement, generateUpdateStatement, getAddColumnStatement, getInsert, getTableName, getUniqueKeyCheck, operator, operator, operator, prepareColumnOrTable, table
-
Constructor Details
-
MssqlSqlDialect
public MssqlSqlDialect()
-
-
Method Details
-
escapeColumnOrTable
- Specified by:
escapeColumnOrTable
in interfaceSqlDialect
-
getUpsert
- Specified by:
getUpsert
in interfaceSqlDialect
-
getUpsertAutoIncrement
public <O> String getUpsertAutoIncrement(CompoundColumnizer<O> columnizer, Class<O> oClass, List<Boolean> keyNulls) - Specified by:
getUpsertAutoIncrement
in interfaceSqlDialect
-
getSqlType
- Specified by:
getSqlType
in interfaceSqlDialect
-
isOrderRequiredForOffset
public boolean isOrderRequiredForOffset()- Specified by:
isOrderRequiredForOffset
in interfaceSqlDialect
-
defaultOrderStatement
- Specified by:
defaultOrderStatement
in interfaceSqlDialect
-
getLimitDefinition
- Specified by:
getLimitDefinition
in interfaceSqlDialect
-
generateUpdateStatement
public String generateUpdateStatement(TableToken table, List<Element> elements, List<Property.PropertyValue<?>> newPropertyValues, List<Property.PropertyValue<?>> incrementPropertyValues) - Specified by:
generateUpdateStatement
in interfaceSqlDialect
-
getInsertAutoIncrement
public <O> String getInsertAutoIncrement(CompoundColumnizer<O> columnizer, Class<O> oClass, List<Boolean> keyNulls) - Specified by:
getInsertAutoIncrement
in interfaceSqlDialect
-
generateDeleteStatement
public String generateDeleteStatement(String tableAlias, TableToken table, List<Element> elements, Integer limit) - Specified by:
generateDeleteStatement
in interfaceSqlDialect
-
describe
- Specified by:
describe
in interfaceSqlDialect
-
describeIndex
- Specified by:
describeIndex
in interfaceSqlDialect
-
getDescribeDbResult
- Specified by:
getDescribeDbResult
in interfaceSqlDialect
-
getDescribeIndexResult
- Specified by:
getDescribeIndexResult
in interfaceSqlDialect
-
generatePrimaryKeyStatement
- Specified by:
generatePrimaryKeyStatement
in interfaceSqlDialect
-
generateIndexStatement
- Specified by:
generateIndexStatement
in interfaceSqlDialect
-
addColumn
-
generateAlterColumnPartStatement
- Specified by:
generateAlterColumnPartStatement
in interfaceSqlDialect
-
generateIndexOnCreateStatement
-
generateDropIndexStatement
- Specified by:
generateDropIndexStatement
in interfaceSqlDialect
-
allowsConversion
- Specified by:
allowsConversion
in interfaceSqlDialect
-
groupConcat
- Specified by:
groupConcat
in interfaceSqlDialect
-
isDuplicateKeyEntry
Description copied from interface:SqlDialect
Check whether an exception was caused by a duplicate value for primary or unique key.- Specified by:
isDuplicateKeyEntry
in interfaceSqlDialect
- Parameters:
e
- the exception to be tested- Returns:
- whether the exception was caused by a unique constraint violation
-
harmonizeLikeValue
Description copied from interface:SqlDialect
Harmonize the value to be used in a LIKE statement.Some databases (e.g. MSSQL) allow for a broader range of special operations to be performed in a LIKE statement. This method takes in the value to be used in a LIKE statement and returns a value that performs the same operation in the current database.
For example, in MSSQL, the value "a[bc]" would match "a", "ab", or "ac", but in MySQL, it would match "a[bc]". As such the value "a[bc]" would need to be harmonized to "a[[]bc]" when used in a LIKE statement in MSSQL.
- Specified by:
harmonizeLikeValue
in interfaceSqlDialect
- Parameters:
value
- the value to be harmonized- Returns:
- the harmonized value
-
getCustomUpsert
public <O> String getCustomUpsert(CompoundColumnizer<O> columnizer, Class<O> modelType, List<Property.PropertyValue<?>> newValues, List<Property.PropertyValue<?>> incrementValues, List<Property<?>> setObjValues, List<Property<?>> incrementByObjValues) - Specified by:
getCustomUpsert
in interfaceSqlDialect
-