FileDocCategorySizeDatePackage
OracleDialect.javaAPI DocHibernate 3.2.52454Fri Jun 08 12:52:20 BST 2007org.hibernate.dialect

OracleDialect

public class OracleDialect extends Oracle9Dialect
An SQL dialect for Oracle, compatible with Oracle 8.
deprecated
Use Oracle8iDialect instead.
author
Gavin King

Fields Summary
private static final Log
log
Constructors Summary
public OracleDialect()


	  
		super();
		log.warn( "The OracleDialect dialect has been deprecated; use Oracle8iDialect instead" );
		// Oracle8 and previous define only a "DATE" type which
		//      is used to represent all aspects of date/time
		registerColumnType( Types.TIMESTAMP, "date" );
		registerColumnType( Types.CHAR, "char(1)" );
		registerColumnType( Types.VARCHAR, 4000, "varchar2($l)" );
	
Methods Summary
public org.hibernate.sql.CaseFragmentcreateCaseFragment()

		return new DecodeCaseFragment();
	
public org.hibernate.sql.JoinFragmentcreateOuterJoinFragment()

		return new OracleJoinFragment();
	
public java.lang.StringgetCurrentTimestampSQLFunctionName()

		return "sysdate";
	
public java.lang.StringgetCurrentTimestampSelectString()

		return "select sysdate from dual";
	
public java.lang.StringgetLimitString(java.lang.String sql, boolean hasOffset)


		sql = sql.trim();
		boolean isForUpdate = false;
		if ( sql.toLowerCase().endsWith(" for update") ) {
			sql = sql.substring( 0, sql.length()-11 );
			isForUpdate = true;
		}
		
		StringBuffer pagingSelect = new StringBuffer( sql.length()+100 );
		if (hasOffset) {
			pagingSelect.append("select * from ( select row_.*, rownum rownum_ from ( ");
		}
		else {
			pagingSelect.append("select * from ( ");
		}
		pagingSelect.append(sql);
		if (hasOffset) {
			pagingSelect.append(" ) row_ ) where rownum_ <= ? and rownum_ > ?");
		}
		else {
			pagingSelect.append(" ) where rownum <= ?");
		}

		if ( isForUpdate ) {
			pagingSelect.append( " for update" );
		}
		
		return pagingSelect.toString();
	
public java.lang.StringgetSelectClauseNullString(int sqlType)

		switch(sqlType) {
			case Types.VARCHAR:
			case Types.CHAR:
				return "to_char(null)";
			case Types.DATE:
			case Types.TIMESTAMP:
			case Types.TIME:
				return "to_date(null)";
			default:
				return "to_number(null)";
		}