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

📄 rdmsos2200dialect.java

📁 hibernate-3.1.3-all-src.zip 面向对象的访问数据库工具
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
        /*
         * The following types are not supported in RDMS/JDBC and therefore commented out.
         * However, in some cases, mapping them to CHARACTER columns works
         * for many applications, but does not work for all cases.
         */
        // registerColumnType(Types.VARBINARY, "CHARACTER($l)");
        // registerColumnType(Types.BLOB, "CHARACTER($l)" );  // For use prior to CP 11.0
        // registerColumnType(Types.CLOB, "CHARACTER($l)" );
	}

    // The following methods over-ride the default behaviour in the Dialect object.

    /**
     * RDMS does not support qualifing index names with the schema name.
     */
	public boolean qualifyIndexName() {
		return false;
	}

	/**
	 * The RDMS DB supports the 'FOR UPDATE OF' clause. However, the RDMS-JDBC
     * driver does not support this feature, so a false is return.
     * The base dialect also returns a false, but we will leave this over-ride
     * in to make sure it stays false.
	 */
	public boolean forUpdateOfColumns() {
		return false;
	}

	/**
	 * Since the RDMS-JDBC driver does not support for updates, this string is
     * set to an empty string. Whenever, the driver does support this feature,
     * the returned string should be " FOR UPDATE OF". Note that RDMS does not
     * support the string 'FOR UPDATE' string.
	 */
	public String getForUpdateString() {
		return ""; // Original Dialect.java returns " for update";
	}
	
    /**
     * RDMS does not support adding Unique constraints via create and alter table.
     */
	public boolean supportsUniqueConstraintInCreateAlterTable() {
	    return true;
	}
	
	// Verify the state of this new method in Hibernate 3.0 Dialect.java
    /**
     * RDMS does not support Cascade Deletes.
     * Need to review this in the future when support is provided. 
     */
		public boolean supportsCascadeDelete() {
		return false; // Origial Dialect.java returns true;
	}

	/**
     * Currently, RDMS-JDBC does not support ForUpdate.
     * Need to review this in the future when support is provided. 
	 */
    public boolean supportsOuterJoinForUpdate() {
		return false;
	}

    /**
     * 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() {
//        return new ExceptionConverter( getViolatedConstraintNameExtracter() );
//    }
//
//    private static class ExceptionConverter extends ErrorCodeConverter {
//        private int[] sqlGrammarCodes = new int[] { 1054, 1064, 1146 };
//        private int[] integrityViolationCodes = new int[] { 1062, 1216, 1217 };
//        private int[] connectionCodes = new int[] { 1049 };
//        private int[] lockAcquisitionErrorCodes = new int[] { 1099, 1100, 1150, 1165, 1192, 1205, 1206, 1207, 1213, 1223 };
//
//        public ExceptionConverter(ViolatedConstraintNameExtracter extracter) {
//            super(extracter);
//        }
//
//        protected int[] getSQLGrammarErrorCodes() {
//            return sqlGrammarCodes;
//        }
//
//        protected int[] getIntegrityViolationErrorCodes() {
//            return integrityViolationCodes;
//        }
//
//        protected int[] getConnectionErrorCodes() {
//            return connectionCodes;
//        }
//
//        protected int[] getLockAcquisitionErrorCodes() {
//            return lockAcquisitionErrorCodes;
//        }
//    }
  

	public String getAddColumnString() {
		return "add";
	}	

	public String getNullColumnString() {
		// The keyword used to specify a nullable column.
		return " null";
	}

    // *** Sequence methods - start. The RDMS dialect needs these
    // methods to make it possible to use the Native Id generator
	public boolean supportsSequences() {
		return true;
	}
	
	public String getSequenceNextValString(String sequenceName) {
	    // The where clause was added to eliminate this statement from Brute Force Searches.
        return  "select permuted_id('NEXT',31) from rdms.rdms_dummy where key_col = 1 ";
	}
	
	public String getCreateSequenceString(String sequenceName) {
        // We must return a valid RDMS/RSA command from this method to
        // prevent RDMS/RSA from issuing *ERROR 400
        return "";
	}
	
	public String getDropSequenceString(String sequenceName) {
        // We must return a valid RDMS/RSA command from this method to
        // prevent RDMS/RSA from issuing *ERROR 400
        return "";
	}
	
	// *** Sequence methods - end	
	
    public String getCascadeConstraintsString() {
        // Used with DROP TABLE to delete all records in the table.
        return " including contents";
    }
	
	public CaseFragment createCaseFragment() {
		return new DecodeCaseFragment();
	}
	
	public boolean supportsLimit() { 
		return true; 
	} 

	public boolean supportsLimitOffset() { 
		return false; 
	}

    public String getLimitString(String sql, int offset, int limit) {
        if (offset>0) throw new UnsupportedOperationException("RDMS does not support paged queries");
		return new StringBuffer(sql.length() + 40) 
			.append(sql) 
			.append(" fetch first ") 
			.append(limit) 
			.append(" rows only ") 
			.toString(); 
	} 

	public boolean supportsVariableLimit() { 
		return false;
	}

	public boolean supportsUnionAll() {
		// RDMS supports the UNION ALL clause.
          return true;
	}
	
}   // End of class RDMSOS2200Dialect

⌨️ 快捷键说明

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