FileDocCategorySizeDatePackage
SQLAnyWherePlatform.javaAPI DocGlassfish v2 API7670Tue May 22 16:54:48 BST 2007oracle.toplink.essentials.platform.database

SQLAnyWherePlatform

public final class SQLAnyWherePlatform extends DatabasePlatform
Provides SQL Anywhere specific behaviour.
author
Markus KARG (markus-karg@users.sourceforge.net)

Fields Summary
Constructors Summary
Methods Summary
protected final java.util.HashtablebuildFieldTypes()

		final Hashtable<Class, FieldTypeDefinition> fieldTypeMapping = new Hashtable<Class, FieldTypeDefinition>();
		fieldTypeMapping.put(Boolean.class, new FieldTypeDefinition("BIT", false));
		fieldTypeMapping.put(Integer.class, new FieldTypeDefinition("INTEGER", false));
		fieldTypeMapping.put(Long.class, new FieldTypeDefinition("BIGINT", false));
		fieldTypeMapping.put(Float.class, new FieldTypeDefinition("REAL", false));
		fieldTypeMapping.put(Double.class, new FieldTypeDefinition("DOUBLE", false));
		fieldTypeMapping.put(Short.class, new FieldTypeDefinition("SMALLINT", false));
		fieldTypeMapping.put(Byte.class, new FieldTypeDefinition("SMALLINT", false));
		fieldTypeMapping.put(BigInteger.class, new FieldTypeDefinition("BIGINT", false));
		fieldTypeMapping.put(BigDecimal.class, new FieldTypeDefinition("DOUBLE", false));
		fieldTypeMapping.put(Number.class, new FieldTypeDefinition("DOUBLE", false));
		fieldTypeMapping.put(String.class, new FieldTypeDefinition("VARCHAR"));
		fieldTypeMapping.put(Character.class, new FieldTypeDefinition("CHAR"));
		fieldTypeMapping.put(Byte[].class, new FieldTypeDefinition("LONG BINARY", false));
		fieldTypeMapping.put(Character[].class, new FieldTypeDefinition("LONG VARCHAR", false));
		fieldTypeMapping.put(byte[].class, new FieldTypeDefinition("LONG BINARY", false));
		fieldTypeMapping.put(char[].class, new FieldTypeDefinition("LONG VARCHAR", false));
		fieldTypeMapping.put(Blob.class, new FieldTypeDefinition("LONG BINARY",	false));
		fieldTypeMapping.put(Clob.class, new FieldTypeDefinition("LONG VARCHAR", false));
		fieldTypeMapping.put(Date.class, new FieldTypeDefinition("DATE", false));
		fieldTypeMapping.put(Time.class, new FieldTypeDefinition("TIME", false));
		fieldTypeMapping.put(Timestamp.class, new FieldTypeDefinition("TIMESTAMP", false));
		return fieldTypeMapping;
	
public final oracle.toplink.essentials.queryframework.ValueReadQuerybuildSelectQueryForNativeSequence()

		return new ValueReadQuery("SELECT @@identity");
	
private static final oracle.toplink.essentials.expressions.ExpressionOperatorcreateCurrentDateOperator()

		return ExpressionOperator.simpleFunctionNoParentheses(ExpressionOperator.CurrentDate, "CURRENT DATE");
	
private static final oracle.toplink.essentials.expressions.ExpressionOperatorcreateCurrentTimeOperator()

		return ExpressionOperator.simpleFunctionNoParentheses(ExpressionOperator.CurrentTime, "CURRENT TIME");
	
private static final oracle.toplink.essentials.expressions.ExpressionOperatorcreateLocate2Operator()

		return ExpressionOperator.simpleThreeArgumentFunction(ExpressionOperator.Locate2, "LOCATE");
	
private static final oracle.toplink.essentials.expressions.ExpressionOperatorcreateLocateOperator()

		return ExpressionOperator.simpleTwoArgumentFunction(ExpressionOperator.Locate, "LOCATE");
	
protected final java.lang.StringgetCreateTempTableSqlPrefix()

		return "DECLARE TEMPORARY TABLE ";
	
public final intgetJDBCType(java.lang.Class javaType)

		return javaType == ClassConstants.BLOB ? Types.LONGVARBINARY :  javaType == ClassConstants.CLOB ? Types.LONGVARCHAR : super.getJDBCType(javaType);
	
public final intgetMaxFieldNameSize()

		return 128;
	
public final oracle.toplink.essentials.internal.helper.DatabaseTablegetTempTableForTable(oracle.toplink.essentials.internal.helper.DatabaseTable table)

		return new DatabaseTable("$" + table.getName(), table.getTableQualifier());
	
protected final voidinitializePlatformOperators()

		super.initializePlatformOperators();
		this.addOperator(SQLAnyWherePlatform.createLocateOperator());
		this.addOperator(SQLAnyWherePlatform.createLocate2Operator());
		this.addOperator(SQLAnyWherePlatform.createCurrentDateOperator());
		this.addOperator(SQLAnyWherePlatform.createCurrentTimeOperator());
		this.addOperator(ExpressionOperator.charLength());
	
public final booleanisSQLAnywhere()

		return true;
	
public final voidprintFieldIdentityClause(java.io.Writer writer)

		try {
			writer.write(" DEFAULT AUTOINCREMENT");
		} catch (final IOException ioException) {
			throw ValidationException.fileError(ioException);
		}
	
public final voidprintFieldNullClause(java.io.Writer writer)

		try {
			writer.write(" NULL");
		} catch (final IOException ioException) {
			throw ValidationException.fileError(ioException);
		}
	
public final booleanshouldNativeSequenceAcquireValueAfterInsert()

		return true;
	
public final booleansupportsLocalTempTables()

		return true;
	
public final booleansupportsNativeSequenceNumbers()

		return true;
	
public final booleansupportsStoredFunctions()

		return true;