📄 dialect.java
字号:
public String getLowercaseFunction() {
return "lower";
}
/**
* Does this <tt>Dialect</tt> have some kind of <tt>LIMIT</tt> syntax?
*/
public boolean supportsLimit() {
return false;
}
/**
* Does this dialect support an offset?
*/
public boolean supportsLimitOffset() {
return supportsLimit();
}
/**
* Add a <tt>LIMIT</tt> clause to the given SQL <tt>SELECT</tt>
*
* @return the modified SQL
*/
public String getLimitString(String querySelect, boolean hasOffset) {
throw new UnsupportedOperationException( "paged queries not supported" );
}
public String getLimitString(String querySelect, int offset, int limit) {
return getLimitString( querySelect, offset>0 );
}
public boolean supportsVariableLimit() {
return supportsLimit();
}
/**
* Does the <tt>LIMIT</tt> clause specify arguments in the "reverse" order
* limit, offset instead of offset, limit?
*
* @return true if the correct order is limit, offset
*/
public boolean bindLimitParametersInReverseOrder() {
return false;
}
/**
* Does the <tt>LIMIT</tt> clause come at the start of the
* <tt>SELECT</tt> statement, rather than at the end?
*
* @return true if limit parameters should come before other parameters
*/
public boolean bindLimitParametersFirst() {
return false;
}
/**
* Does the <tt>LIMIT</tt> clause take a "maximum" row number instead
* of a total number of returned rows?
*/
public boolean useMaxForLimit() {
return false;
}
/**
* The opening quote for a quoted identifier
*/
public char openQuote() {
return '"';
}
/**
* The closing quote for a quoted identifier
*/
public char closeQuote() {
return '"';
}
/**
* SQL functions as defined in general. The results of this
* method should be integrated with the specialisation's data.
*/
public final Map getFunctions() {
return sqlFunctions;
}
public boolean supportsIfExistsBeforeTableName() {
return false;
}
public boolean supportsIfExistsAfterTableName() {
return false;
}
/**
* Does this dialect support column-level check constraints?
*/
public boolean supportsColumnCheck() {
return true;
}
/**
* Does this dialect support table-level check constraints?
*/
public boolean supportsTableCheck() {
return true;
}
/**
* Whether this dialect have an Identity clause added to the data type or a
* completely seperate identity data type
*
* @return boolean
*/
public boolean hasDataTypeInIdentityColumn() {
return true;
}
public boolean supportsCascadeDelete() {
return true;
}
/**
* Method <code>appendLockHint</code> appends according to the given
* lock mode a lock hint behind the given table name, if this dialect
* needs this. MS SQL Server for example doesn't support the
* standard "<code>select ... for update</code>" syntax and use a
* special "<code>select ... from TABLE as ALIAS with (updlock, rowlock)
* where ...</code>" syntax instead.
*
* @param tableName name of table to append lock hint
* @return String
* <p/>
* author <a href="http://sourceforge.net/users/heschulz">Helge Schulz</a>
*/
public String appendLockHint(LockMode mode, String tableName) {
return tableName;
}
public Class getNativeIdentifierGeneratorClass() {
if ( supportsIdentityColumns() ) {
return IdentityGenerator.class;
}
else if ( supportsSequences() ) {
return SequenceGenerator.class;
}
else {
return TableHiLoGenerator.class;
}
}
public String getSelectGUIDString() {
throw new UnsupportedOperationException( "dialect does not support GUIDs" );
}
public boolean supportsOuterJoinForUpdate() {
return true;
}
public String getSelectClauseNullString(int sqlType) {
return "null";
}
public boolean supportsNotNullUnique() {
return true;
}
/**
* Build an instance of the SQLExceptionConverter preferred by this dialect for
* converting SQLExceptions into Hibernate's JDBCException hierarchy. The default
* Dialect implementation simply returns a converter based on X/Open SQLState codes.
* <p/>
* It is strongly recommended that specific Dialect implementations override this
* method, since interpretation of a SQL error is much more accurate when based on
* the ErrorCode rather than the SQLState. Unfortunately, the ErrorCode is a vendor-
* specific approach.
*
* @return The Dialect's preferred SQLExceptionConverter.
*/
public SQLExceptionConverter buildSQLExceptionConverter() {
// The default SQLExceptionConverter for all dialects is based on SQLState
// since SQLErrorCode is extremely vendor-specific. Specific Dialects
// may override to return whatever is most appropriate for that vendor.
return new SQLStateConverter( getViolatedConstraintNameExtracter() );
}
private static final ViolatedConstraintNameExtracter EXTRACTER = new ViolatedConstraintNameExtracter() {
public String extractConstraintName(SQLException sqle) {
return null;
}
};
public ViolatedConstraintNameExtracter getViolatedConstraintNameExtracter() {
return EXTRACTER;
}
public final String quote(String column) {
if ( column.charAt( 0 ) == '`' ) {
return openQuote() + column.substring( 1, column.length() - 1 ) + closeQuote();
}
else {
return column;
}
}
public boolean hasSelfReferentialForeignKeyBug() {
return false;
}
public boolean useInputStreamToInsertBlob() {
return true;
}
public int registerResultSetOutParameter(CallableStatement statement, int col) throws SQLException {
throw new UnsupportedOperationException(
getClass().getName() +
" does not support resultsets via stored procedures"
);
}
public ResultSet getResultSet(CallableStatement ps) throws SQLException {
throw new UnsupportedOperationException(
getClass().getName() +
" does not support resultsets via stored procedures"
);
}
public boolean supportsUnionAll() {
return false;
}
public boolean supportsCommentOn() {
return false;
}
public String getTableComment(String comment) {
return "";
}
public String getColumnComment(String comment) {
return "";
}
public String transformSelectString(String select) {
return select;
}
public boolean supportsTemporaryTables() {
return false;
}
public String generateTemporaryTableName(String baseTableName) {
return "HT_" + baseTableName;
}
public String getCreateTemporaryTableString() {
return "create table";
}
public boolean performTemporaryTableDDLInIsolation() {
return false;
}
public String getCreateTemporaryTablePostfix() {
return "";
}
public boolean dropTemporaryTableAfterUse() {
return true;
}
public String getForUpdateString(LockMode lockMode) {
if ( lockMode==LockMode.UPGRADE ) {
return getForUpdateString();
}
else if ( lockMode==LockMode.UPGRADE_NOWAIT ) {
return getForUpdateNowaitString();
}
else if ( lockMode==LockMode.FORCE ) {
return getForUpdateNowaitString();
}
else {
return "";
}
}
public int getMaxAliasLength() {
return 10;
}
public boolean supportsCurrentTimestampSelection() {
return false;
}
public String getCurrentTimestampSelectString() {
throw new UnsupportedOperationException( "Database not known to define a current timestamp function" );
}
public boolean isCurrentTimestampSelectStringCallable() {
throw new UnsupportedOperationException( "Database not known to define a current timestamp function" );
}
/**
* The SQL value that the JDBC driver maps boolean values to
*/
public String toBooleanValueString(boolean bool) {
return bool ? "1" : "0";
}
/**
* Does this dialect support parameters within the select clause of
* INSERT ... SELECT ... statements?
*
* @return True if this is supported; false otherwise.
*/
public boolean supportsParametersInInsertSelect() {
return true;
}
/**
* The name of the database-specific SQL function for retrieving the
* current timestamp.
*
* @return The function name.
*/
public String getCurrentTimestampSQLFunctionName() {
// the standard SQL function name is current_timestamp...
return "current_timestamp";
}
/**
* Get a strategy instance which knows how to acquire a database-level lock
* of the specified mode for this dialect.
*
* @param lockable The persister for the entity to be locked.
* @param lockMode The type of lock to be acquired.
* @return The appropriate locking strategy.
* @since 3.2
*/
public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode) {
return new SelectLockingStrategy( lockable, lockMode );
}
/**
* Is this dialect known to support what ANSI-SQL terms "row value
* constructor" syntax; sometimes called tuple syntax.
* <p/>
* Basically, does it support syntax like
* "... where (FIRST_NAME, LAST_NAME) = ('Steve', 'Ebersole') ...".
*
* @return True if this SQL dialect is known to support "row value
* constructor" syntax; false otherwise.
* @since 3.2
*/
public boolean supportsRowValueConstructorSyntax() {
// return false here, as most databases do not properly support this construct...
return false;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -