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

TimesTenPlatform

public class TimesTenPlatform extends DatabasePlatform

Fields Summary
private boolean
supportsForeignKeyConstraints
Constructors Summary
public TimesTenPlatform()

        supportsForeignKeyConstraints = true;
    
Methods Summary
protected voidappendByteArray(byte[] bytes, java.io.Writer writer)
If using native SQL then print a byte[] literally as a hex string otherwise use ODBC format as provided in DatabasePlatform.

        if (usesNativeSQL()) {
            writer.write("Ox");
            Helper.writeHexString(bytes, writer);
        } else {
            super.appendByteArray(bytes, writer);
        }
    
protected voidappendCalendar(java.util.Calendar calendar, java.io.Writer writer)
Appends an MySQL specific Timestamp, if usesNativeSQL is true otherwise use the ODBC format. Native Format: 'YYYY-MM-DD HH:MM:SS'

        if (usesNativeSQL()) {
            writer.write("TIMESTAMP '");
            writer.write(Helper.printCalendarWithoutNanos(calendar));
            writer.write("'");
        } else {
            super.appendCalendar(calendar, writer);
        }
    
protected voidappendDate(java.sql.Date date, java.io.Writer writer)
Appends an MySQL specific date if usesNativeSQL is true otherwise use the ODBC format. Native FORMAT: 'YYYY-MM-DD'

        if (usesNativeSQL()) {
            writer.write("DATE '");
            writer.write(Helper.printDate(date));
            writer.write("'");
        } else {
            super.appendDate(date, writer);
        }
    
protected voidappendTime(java.sql.Time time, java.io.Writer writer)
Appends an MySQL specific time if usesNativeSQL is true otherwise use the ODBC format. Native FORMAT: 'HH:MM:SS'.

        if (usesNativeSQL()) {
            writer.write("TIME '");
            writer.write(Helper.printTime(time));
            writer.write("'");
        } else {
            super.appendTime(time, writer);
        }
    
protected voidappendTimestamp(java.sql.Timestamp timestamp, java.io.Writer writer)
Appends an MySQL specific Timestamp, if usesNativeSQL is true otherwise use the ODBC format. Native Format: 'YYYY-MM-DD HH:MM:SS'

        if (usesNativeSQL()) {
            writer.write("TIMESTAMP '");
            writer.write(Helper.printTimestampWithoutNanos(timestamp));
            writer.write("'");
        } else {
            super.appendTimestamp(timestamp, writer);
        }
    
protected java.util.HashtablebuildFieldTypes()
Return the mapping of class types to database types for the schema framework.

        Hashtable fieldTypeMapping;

        fieldTypeMapping = new Hashtable();
        fieldTypeMapping.put(Boolean.class, new FieldTypeDefinition("TINYINT", false));

        fieldTypeMapping.put(Integer.class, new FieldTypeDefinition("INTEGER", false));
        fieldTypeMapping.put(Long.class, new FieldTypeDefinition("BIGINT", false));
        fieldTypeMapping.put(Float.class, new FieldTypeDefinition("FLOAT", false));
        fieldTypeMapping.put(Double.class, new FieldTypeDefinition("DOUBLE", false));
        fieldTypeMapping.put(Short.class, new FieldTypeDefinition("SMALLINT", false));
        fieldTypeMapping.put(Byte.class, new FieldTypeDefinition("TINYINT", false));
        fieldTypeMapping.put(java.math.BigInteger.class, new FieldTypeDefinition("BIGINT", false));
        fieldTypeMapping.put(java.math.BigDecimal.class, new FieldTypeDefinition("DECIMAL(38)", false));
        fieldTypeMapping.put(Number.class, new FieldTypeDefinition("DECIMAL(38)", false));

        fieldTypeMapping.put(String.class, new FieldTypeDefinition("VARCHAR", 255));
        fieldTypeMapping.put(Character.class, new FieldTypeDefinition("CHAR", 1));

        fieldTypeMapping.put(Byte[].class, new FieldTypeDefinition("VARBINARY", 64000));
        fieldTypeMapping.put(Character[].class, new FieldTypeDefinition("VARCHAR", 64000));
        fieldTypeMapping.put(byte[].class, new FieldTypeDefinition("VARBINARY", 64000));
        fieldTypeMapping.put(char[].class, new FieldTypeDefinition("VARCHAR", 64000));
        fieldTypeMapping.put(java.sql.Blob.class, new FieldTypeDefinition("VARBINARY", 64000));
        fieldTypeMapping.put(java.sql.Clob.class, new FieldTypeDefinition("VARCHAR", 64000));        
        
        fieldTypeMapping.put(java.sql.Date.class, new FieldTypeDefinition("DATE", false));
        fieldTypeMapping.put(java.sql.Time.class, new FieldTypeDefinition("TIME", false));
        fieldTypeMapping.put(java.sql.Timestamp.class, new FieldTypeDefinition("TIMESTAMP", false));

        return fieldTypeMapping;
    
public oracle.toplink.essentials.queryframework.ValueReadQuerybuildSelectQueryForNativeSequence(java.lang.String seqName, java.lang.Integer size)
INTERNAL: Produce a DataReadQuery which updates(!) the sequence number in the db and returns it.

param
sequenceName Name known by TimesTen to be a defined sequence

        return new ValueReadQuery("SELECT " + getQualifiedSequenceName(seqName) + ".NEXTVAL FROM DUAL");
    
public java.lang.StringgetCreateViewString()
INTERNAL: Used for view creation.

        return "CREATE MATERIALIZED VIEW ";
    
protected java.lang.StringgetQualifiedSequenceName(java.lang.String seqName)
Prepend sequence name with table qualifier (if any)

        if (getTableQualifier().equals("")) {
            return seqName;
        } else {
            return getTableQualifier() + "." + seqName;
        }
    
public java.lang.StringgetSelectForUpdateString()
INTERNAL: Used for pessimistic locking.

        return " FOR UPDATE";
    
public oracle.toplink.essentials.queryframework.ValueReadQuerygetTimestampQuery()
PUBLIC: This method returns the query to select the timestamp from the server for TimesTen.

        if (timestampQuery == null) {
            timestampQuery = new ValueReadQuery();
            timestampQuery.setSQLString("SELECT SYSDATE FROM DUAL");
        }
        return timestampQuery;
    
protected voidinitializePlatformOperators()
Initialize any platform-specific operators

        super.initializePlatformOperators();
        addOperator(ExpressionOperator.simpleTwoArgumentFunction(ExpressionOperator.Concat, "CONCAT"));
        addOperator(operatorOuterJoin());
        addOperator(ExpressionOperator.ifNull());
    
public booleanisTimesTen()
Answers whether platform is TimesTen

        return true;
    
protected oracle.toplink.essentials.expressions.ExpressionOperatoroperatorOuterJoin()
Create the outer join operator for this platform

        ExpressionOperator result = new ExpressionOperator();
        result.setSelector(ExpressionOperator.EqualOuterJoin);
        Vector v = new Vector(2);
        v.addElement(" (+) = ");
        result.printsAs(v);
        result.bePostfix();
        result.setNodeClass(RelationExpression.class);
        return result;
    
public voidsetSupportsForeignKeyConstraints(boolean supportsForeignKeyConstraints)

        this.supportsForeignKeyConstraints = supportsForeignKeyConstraints;
    
public booleanshouldPrintOuterJoinInWhereClause()
Some database require outer joins to be given in the where clause, others require it in the from clause.

        return true;
    
public booleansupportsForeignKeyConstraints()

        return supportsForeignKeyConstraints;
    
public booleansupportsNativeSequenceNumbers()
Return true if the receiver uses host sequence numbers, generated on the database. TimesTen does through global sequence objects.

        return true;