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

DBasePlatform

public class DBasePlatform extends DatabasePlatform

Purpose: Provides DBase specific behaviour.

Responsibilities:

  • Writing Time & Timestamp as strings since they are not supported.
since
TOPLink/Java 1.0

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

        Hashtable fieldTypeMapping;

        fieldTypeMapping = new Hashtable();
        fieldTypeMapping.put(Boolean.class, new FieldTypeDefinition("NUMBER", 1));

        fieldTypeMapping.put(Integer.class, new FieldTypeDefinition("NUMBER", 11));
        fieldTypeMapping.put(Long.class, new FieldTypeDefinition("NUMBER", 19));
        fieldTypeMapping.put(Float.class, new FieldTypeDefinition("NUMBER", 12, 5).setLimits(19, 0, 19));
        fieldTypeMapping.put(Double.class, new FieldTypeDefinition("NUMBER", 10, 5).setLimits(19, 0, 19));
        fieldTypeMapping.put(Short.class, new FieldTypeDefinition("NUMBER", 6));
        fieldTypeMapping.put(Byte.class, new FieldTypeDefinition("NUMBER", 4));
        fieldTypeMapping.put(java.math.BigInteger.class, new FieldTypeDefinition("NUMBER", 19));
        fieldTypeMapping.put(java.math.BigDecimal.class, new FieldTypeDefinition("NUMBER", 19).setLimits(19, 0, 9));
        fieldTypeMapping.put(Number.class, new FieldTypeDefinition("NUMBER", 19).setLimits(19, 0, 9));

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

        fieldTypeMapping.put(Byte[].class, new FieldTypeDefinition("BINARY"));
        fieldTypeMapping.put(Character[].class, new FieldTypeDefinition("MEMO"));
        fieldTypeMapping.put(byte[].class, new FieldTypeDefinition("BINARY"));
        fieldTypeMapping.put(char[].class, new FieldTypeDefinition("MEMO"));
        fieldTypeMapping.put(java.sql.Blob.class, new FieldTypeDefinition("BINARY"));
        fieldTypeMapping.put(java.sql.Clob.class, new FieldTypeDefinition("MEMO"));        

        fieldTypeMapping.put(java.sql.Date.class, new FieldTypeDefinition("DATE", false));
        fieldTypeMapping.put(java.sql.Time.class, new FieldTypeDefinition("CHAR", 15));
        fieldTypeMapping.put(java.sql.Timestamp.class, new FieldTypeDefinition("CHAR", 25));

        return fieldTypeMapping;
    
public java.lang.ObjectconvertToDatabaseType(java.lang.Object value)
INTERNAL: DBase does not support Time/Timestamp so we must map to strings. 2.0p22: protected->public INTERNAL

        Object dbValue = super.convertToDatabaseType(value);
        if ((dbValue instanceof java.sql.Time) || (dbValue instanceof java.sql.Timestamp)) {
            return dbValue.toString();
        }
        return dbValue;
    
public intgetMaxFieldNameSize()
INTERNAL: returns the maximum number of characters that can be used in a field name on this platform.

        return 10;
    
public java.lang.StringgetSelectForUpdateString()
INTERNAL:

        return " FOR UPDATE OF *";
    
public booleanisDBase()

        return true;
    
public java.util.HashtablemaximumNumericValues()
INTERNAL: Builds a table of minimum numeric values keyed on java class. This is used for type testing but might also be useful to end users attempting to sanitize values.

NOTE: BigInteger & BigDecimal minimums are dependent upon their precision & Scale

        Hashtable values = new Hashtable();

        values.put(Integer.class, new Integer(Integer.MAX_VALUE));
        values.put(Long.class, Long.valueOf("922337203685478000"));
        values.put(Double.class, new Double("99999999.999999999"));
        values.put(Short.class, new Short(Short.MIN_VALUE));
        values.put(Byte.class, new Byte(Byte.MIN_VALUE));
        values.put(Float.class, new Float("99999999.999999999"));
        values.put(java.math.BigInteger.class, new java.math.BigInteger("922337203685478000"));
        values.put(java.math.BigDecimal.class, new java.math.BigDecimal("999999.999999999"));
        return values;
    
public java.util.HashtableminimumNumericValues()
INTERNAL: Builds a table of minimum numeric values keyed on java class. This is used for type testing but might also be useful to end users attempting to sanitize values.

NOTE: BigInteger & BigDecimal minimums are dependent upon their precision & Scale

        Hashtable values = new Hashtable();

        values.put(Integer.class, new Integer(Integer.MIN_VALUE));
        values.put(Long.class, Long.valueOf("-922337203685478000"));
        values.put(Double.class, new Double("-99999999.999999999"));
        values.put(Short.class, new Short(Short.MIN_VALUE));
        values.put(Byte.class, new Byte(Byte.MIN_VALUE));
        values.put(Float.class, new Float("-99999999.999999999"));
        values.put(java.math.BigInteger.class, new java.math.BigInteger("-922337203685478000"));
        values.put(java.math.BigDecimal.class, new java.math.BigDecimal("-999999.999999999"));
        return values;
    
public voidprintFieldNotNullClause(java.io.Writer writer)
INTERNAL: Append the receiver's field 'NOT NULL' constraint clause to a writer.

        // Do nothing
    
public booleanshouldUseJDBCOuterJoinSyntax()
INTERNAL: JDBC defines and outer join syntax, many drivers do not support this. So we normally avoid it.

        return false;
    
public booleansupportsForeignKeyConstraints()
INTERNAL:

        return false;
    
public booleansupportsPrimaryKeyConstraint()
INTERNAL:

        return false;