FileDocCategorySizeDatePackage
InformixDialect.javaAPI DocHibernate 3.2.56608Fri Feb 09 08:43:16 GMT 2007org.hibernate.dialect

InformixDialect

public class InformixDialect extends Dialect
Informix dialect.

Seems to work with Informix Dynamic Server Version 7.31.UD3, Informix JDBC driver version 2.21JC3.
author
Steve Molitor

Fields Summary
private static org.hibernate.exception.ViolatedConstraintNameExtracter
EXTRACTER
Constructors Summary
public InformixDialect()
Creates new InformixDialect instance. Sets up the JDBC / Informix type mappings.

		super();

		registerColumnType(Types.BIGINT, "int8");
		registerColumnType(Types.BINARY, "byte");
		registerColumnType(Types.BIT, "smallint"); // Informix doesn't have a bit type
		registerColumnType(Types.CHAR, "char($l)");
		registerColumnType(Types.DATE, "date");
		registerColumnType(Types.DECIMAL, "decimal");
        registerColumnType(Types.DOUBLE, "float");
        registerColumnType(Types.FLOAT, "smallfloat");
		registerColumnType(Types.INTEGER, "integer");
		registerColumnType(Types.LONGVARBINARY, "blob"); // or BYTE
		registerColumnType(Types.LONGVARCHAR, "clob"); // or TEXT?
		registerColumnType(Types.NUMERIC, "decimal"); // or MONEY
		registerColumnType(Types.REAL, "smallfloat");
		registerColumnType(Types.SMALLINT, "smallint");
		registerColumnType(Types.TIMESTAMP, "datetime year to fraction(5)");
		registerColumnType(Types.TIME, "datetime hour to second");
		registerColumnType(Types.TINYINT, "smallint");
		registerColumnType(Types.VARBINARY, "byte");
		registerColumnType(Types.VARCHAR, "varchar($l)");
		registerColumnType(Types.VARCHAR, 255, "varchar($l)");
		registerColumnType(Types.VARCHAR, 32739, "lvarchar($l)");

		registerFunction( "concat", new VarArgsSQLFunction( Hibernate.STRING, "(", "||", ")" ) );
	
Methods Summary
public java.lang.StringgetAddColumnString()

		return "add";
	
public java.lang.StringgetAddForeignKeyConstraintString(java.lang.String constraintName, java.lang.String[] foreignKey, java.lang.String referencedTable, java.lang.String[] primaryKey, boolean referencesPrimaryKey)
The syntax used to add a foreign key constraint to a table. Informix constraint name must be at the end.

return
String

		StringBuffer result = new StringBuffer(30);
		
		result.append(" add constraint ")
			.append(" foreign key (")
			.append( StringHelper.join(", ", foreignKey) )
			.append(") references ")
			.append(referencedTable);
		
		if(!referencesPrimaryKey) {
			result.append(" (")
			   .append( StringHelper.join(", ", primaryKey) )
			   .append(')");
		}

		result.append(" constraint ").append(constraintName);
			
			return result.toString();
	
public java.lang.StringgetAddPrimaryKeyConstraintString(java.lang.String constraintName)
The syntax used to add a primary key constraint to a table. Informix constraint name must be at the end.

return
String

		return " add constraint primary key constraint " + constraintName + " ";
	
public java.lang.StringgetCreateSequenceString(java.lang.String sequenceName)

		return "create sequence " + sequenceName;
	
public java.lang.StringgetCurrentTimestampSelectString()

		return "select distinct current timestamp from informix.systables";
	
public java.lang.StringgetDropSequenceString(java.lang.String sequenceName)

		return "drop sequence " + sequenceName + " restrict";
	
public java.lang.StringgetIdentityColumnString(int type)

		return type==Types.BIGINT ?
			"serial8 not null" :
			"serial not null";
	
public java.lang.StringgetIdentitySelectString(java.lang.String table, java.lang.String column, int type)

		return type==Types.BIGINT ?
			"select dbinfo('serial8') from systables where tabid=1" :
			"select dbinfo('sqlca.sqlerrd1') from systables where tabid=1";
	
public java.lang.StringgetLimitString(java.lang.String querySelect, int offset, int limit)

		if (offset>0) throw new UnsupportedOperationException("informix has no offset");
		return new StringBuffer( querySelect.length()+8 )
			.append(querySelect)
			.insert( querySelect.toLowerCase().indexOf( "select" ) + 6, " first " + limit )
			.toString();
	
public java.lang.StringgetSelectSequenceNextValString(java.lang.String sequenceName)

		return sequenceName + ".nextval";
	
public java.lang.StringgetSequenceNextValString(java.lang.String sequenceName)

		return "select " + getSelectSequenceNextValString( sequenceName ) + " from systables where tabid=1";
	
public org.hibernate.exception.ViolatedConstraintNameExtractergetViolatedConstraintNameExtracter()

        return EXTRACTER;
	
public booleanhasDataTypeInIdentityColumn()

		return false;
	
public booleanisCurrentTimestampSelectStringCallable()

		return false;
	
public booleansupportsCurrentTimestampSelection()


	   
		return true;
	
public booleansupportsIdentityColumns()

		return true;
	
public booleansupportsLimit()

		return true;
	
public booleansupportsLimitOffset()

		return false;
	
public booleansupportsSequences()

		return true;
	
public booleansupportsVariableLimit()

		return false;
	
public booleanuseMaxForLimit()

		return true;