⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dialect.java

📁 hibernate-distribution-3.3.1.GA-dist.zip源码
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
	 * is the back-tick (`).  If so, the dialect specific quoting is applied.	 *	 * @param column The value to be quoted.	 * @return The quoted (or unmodified, if not starting with back-tick) value.	 * @see #openQuote()	 * @see #closeQuote()	 */	public final String quote(String column) {		if ( column.charAt( 0 ) == '`' ) {			return openQuote() + column.substring( 1, column.length() - 1 ) + closeQuote();		}		else {			return column;		}	}	// DDL support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~	/**	 * Does this dialect support the <tt>ALTER TABLE</tt> syntax?	 *	 * @return True if we support altering of tables; false otherwise.	 */	public boolean hasAlterTable() {		return true;	}	/**	 * Do we need to drop constraints before dropping tables in this dialect?	 *	 * @return True if constraints must be dropped prior to dropping	 * the table; false otherwise.	 */	public boolean dropConstraints() {		return true;	}	/**	 * Do we need to qualify index names with the schema name?	 *	 * @return boolean	 */	public boolean qualifyIndexName() {		return true;	}	/**	 * Does this dialect support the <tt>UNIQUE</tt> column syntax?	 *	 * @return boolean	 */	public boolean supportsUnique() {		return true;	}    /**     * Does this dialect support adding Unique constraints via create and alter table ?     * @return boolean     */	public boolean supportsUniqueConstraintInCreateAlterTable() {	    return true;	}	/**	 * The syntax used to add a column to a table (optional).	 *	 * @return The "add column" fragment.	 */	public String getAddColumnString() {		throw new UnsupportedOperationException( "No add column syntax supported by Dialect" );	}	public String getDropForeignKeyString() {		return " drop constraint ";	}	public String getTableTypeString() {		// grrr... for differentiation of mysql storage engines		return "";	}	/**	 * The syntax used to add a foreign key constraint to a table.	 *	 * @param constraintName The FK constraint name.	 * @param foreignKey The names of the columns comprising the FK	 * @param referencedTable The table referenced by the FK	 * @param primaryKey The explicit columns in the referencedTable referenced	 * by this FK.	 * @param referencesPrimaryKey if false, constraint should be	 * explicit about which column names the constraint refers to	 *	 * @return the "add FK" fragment	 */	public String getAddForeignKeyConstraintString(			String constraintName,			String[] foreignKey,			String referencedTable,			String[] primaryKey,			boolean referencesPrimaryKey) {		StringBuffer res = new StringBuffer( 30 );		res.append( " add constraint " )				.append( constraintName )				.append( " foreign key (" )				.append( StringHelper.join( ", ", foreignKey ) )				.append( ") references " )				.append( referencedTable );		if ( !referencesPrimaryKey ) {			res.append( " (" )					.append( StringHelper.join( ", ", primaryKey ) )					.append( ')' );		}		return res.toString();	}	/**	 * The syntax used to add a primary key constraint to a table.	 *	 * @param constraintName The name of the PK constraint.	 * @return The "add PK" fragment	 */	public String getAddPrimaryKeyConstraintString(String constraintName) {		return " add constraint " + constraintName + " primary key ";	}	public boolean hasSelfReferentialForeignKeyBug() {		return false;	}	/**	 * The keyword used to specify a nullable column.	 *	 * @return String	 */	public String getNullColumnString() {		return "";	}	public boolean supportsCommentOn() {		return false;	}	public String getTableComment(String comment) {		return "";	}	public String getColumnComment(String comment) {		return "";	}	public boolean supportsIfExistsBeforeTableName() {		return false;	}	public boolean supportsIfExistsAfterTableName() {		return false;	}	/**	 * Does this dialect support column-level check constraints?	 *	 * @return True if column-level CHECK constraints are supported; false	 * otherwise.	 */	public boolean supportsColumnCheck() {		return true;	}	/**	 * Does this dialect support table-level check constraints?	 *	 * @return True if table-level CHECK constraints are supported; false	 * otherwise.	 */	public boolean supportsTableCheck() {		return true;	}	public boolean supportsCascadeDelete() {		return true;	}	public boolean supportsNotNullUnique() {		return true;	}	/**	 * Completely optional cascading drop clause	 *	 * @return String	 */	public String getCascadeConstraintsString() {		return "";	}	// Informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~	/**	 * Does this dialect support empty IN lists?	 * <p/>	 * For example, is [where XYZ in ()] a supported construct?	 *	 * @return True if empty in lists are supported; false otherwise.	 * @since 3.2	 */	public boolean supportsEmptyInList() {		return true;	}	/**	 * Are string comparisons implicitly case insensitive.	 * <p/>	 * In other words, does [where 'XYZ' = 'xyz'] resolve to true?	 *	 * @return True if comparisons are case insensitive.	 * @since 3.2	 */	public boolean areStringComparisonsCaseInsensitive() {		return false;	}	/**	 * 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;	}	/**	 * If the dialect supports {@link #supportsRowValueConstructorSyntax() row values},	 * does it offer such support in IN lists as well?	 * <p/>	 * For example, "... where (FIRST_NAME, LAST_NAME) IN ( (?, ?), (?, ?) ) ..."	 *	 * @return True if this SQL dialect is known to support "row value	 * constructor" syntax in the IN list; false otherwise.	 * @since 3.2	 */	public boolean supportsRowValueConstructorSyntaxInInList() {		return false;	}	/**	 * Should LOBs (both BLOB and CLOB) be bound using stream operations (i.e.	 * {@link java.sql.PreparedStatement#setBinaryStream}).	 *	 * @return True if BLOBs and CLOBs should be bound using stream operations.	 * @since 3.2	 */	public boolean useInputStreamToInsertBlob() {		return true;	}	/**	 * Does this dialect support parameters within the select clause of	 * INSERT ... SELECT ... statements?	 *	 * @return True if this is supported; false otherwise.	 * @since 3.2	 */	public boolean supportsParametersInInsertSelect() {		return true;	}	/**	 * Does this dialect support asking the result set its positioning	 * information on forward only cursors.  Specifically, in the case of	 * scrolling fetches, Hibernate needs to use	 * {@link java.sql.ResultSet#isAfterLast} and	 * {@link java.sql.ResultSet#isBeforeFirst}.  Certain drivers do not	 * allow access to these methods for forward only cursors.	 * <p/>	 * NOTE : this is highly driver dependent!	 *	 * @return True if methods like {@link java.sql.ResultSet#isAfterLast} and	 * {@link java.sql.ResultSet#isBeforeFirst} are supported for forward	 * only cursors; false otherwise.	 * @since 3.2	 */	public boolean supportsResultSetPositionQueryMethodsOnForwardOnlyCursor() {		return true;	}	/**	 * Does this dialect support definition of cascade delete constraints	 * which can cause circular chains?	 *	 * @return True if circular cascade delete constraints are supported; false	 * otherwise.	 * @since 3.2	 */	public boolean supportsCircularCascadeDeleteConstraints() {		return true;	}	/**	 * Are subselects supported as the left-hand-side (LHS) of	 * IN-predicates.	 * <p/>	 * In other words, is syntax like "... <subquery> IN (1, 2, 3) ..." supported?	 *	 * @return True if subselects can appear as the LHS of an in-predicate;	 * false otherwise.	 * @since 3.2	 */	public boolean  supportsSubselectAsInPredicateLHS() {		return true;	}	/**	 * Expected LOB usage pattern is such that I can perform an insert	 * via prepared statement with a parameter binding for a LOB value	 * without crazy casting to JDBC driver implementation-specific classes...	 * <p/>	 * Part of the trickiness here is the fact that this is largely	 * driver dependent.  For example, Oracle (which is notoriously bad with	 * LOB support in their drivers historically) actually does a pretty good	 * job with LOB support as of the 10.2.x versions of their drivers...	 *	 * @return True if normal LOB usage patterns can be used with this driver;	 * false if driver-specific hookiness needs to be applied.	 * @since 3.2	 */	public boolean supportsExpectedLobUsagePattern() {		return true;	}	/**	 * Does the dialect support propogating changes to LOB	 * values back to the database?  Talking about mutating the	 * internal value of the locator as opposed to supplying a new	 * locator instance...	 * <p/>	 * For BLOBs, the internal value might be changed by:	 * {@link java.sql.Blob#setBinaryStream},	 * {@link java.sql.Blob#setBytes(long, byte[])},	 * {@link java.sql.Blob#setBytes(long, byte[], int, int)},	 * or {@link java.sql.Blob#truncate(long)}.	 * <p/>	 * For CLOBs, the internal value might be changed by:	 * {@link java.sql.Clob#setAsciiStream(long)},	 * {@link java.sql.Clob#setCharacterStream(long)},	 * {@link java.sql.Clob#setString(long, String)},	 * {@link java.sql.Clob#setString(long, String, int, int)},	 * or {@link java.sql.Clob#truncate(long)}.	 * <p/>	 * NOTE : I do not know the correct answer currently for	 * databases which (1) are not part of the cruise control process	 * or (2) do not {@link #supportsExpectedLobUsagePattern}.	 *	 * @return True if the changes are propogated back to the	 * database; false otherwise.	 * @since 3.2	 */	public boolean supportsLobValueChangePropogation() {		return true;	}	/**	 * Is it supported to materialize a LOB locator outside the transaction in	 * which it was created?	 * <p/>	 * Again, part of the trickiness here is the fact that this is largely	 * driver dependent.	 * <p/>	 * NOTE: all database I have tested which {@link #supportsExpectedLobUsagePattern()}	 * also support the ability to materialize a LOB outside the owning transaction...	 *	 * @return True if unbounded materialization is supported; false otherwise.	 * @since 3.2	 */	public boolean supportsUnboundedLobLocatorMaterialization() {		return true;	}	/**	 * Does this dialect support referencing the table being mutated in	 * a subquery.  The "table being mutated" is the table referenced in	 * an UPDATE or a DELETE query.  And so can that table then be	 * referenced in a subquery of said UPDATE/DELETE query.	 * <p/>	 * For example, would the following two syntaxes be supported:<ul>	 * <li>delete from TABLE_A where ID not in ( select ID from TABLE_A )</li>	 * <li>update TABLE_A set NON_ID = 'something' where ID in ( select ID from TABLE_A)</li>	 * </ul>	 *	 * @return True if this dialect allows references the mutating table from	 * a subquery.	 */	public boolean supportsSubqueryOnMutatingTable() {		return true;	}	/**	 * Does the dialect support an exists statement in the select clause?	 *	 * @return True if exists checks are allowed in the select clause; false otherwise.	 */	public boolean supportsExistsInSelect() {		return true;	}	/**	 * For the underlying database, is READ_COMMITTED isolation implemented by	 * forcing readers to wait for write locks to be released?	 *	 * @return True if writers block readers to achieve READ_COMMITTED; false otherwise.	 */	public boolean doesReadCommittedCauseWritersToBlockReaders() {		return false;	}	/**	 * For the underlying database, is REPEATABLE_READ isolation implemented by	 * forcing writers to wait for read locks to be released?	 *	 * @return True if readers block writers to achieve REPEATABLE_READ; false otherwise.	 */	public boolean doesRepeatableReadCauseReadersToBlockWriters() {		return false;	}	/**	 * Does this dialect support using a JDBC bind parameter as an argument	 * to a function or procedure call?	 *	 * @return True if the database supports accepting bind params as args; false otherwise.	 */	public boolean supportsBindAsCallableArgument() {		return true;	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -