1 21 package oracle.toplink.essentials.platform.database; 23 24 import java.io.*; 25 import java.util.*; 26 import oracle.toplink.essentials.internal.databaseaccess.*; 27 28 36 public class DBasePlatform extends oracle.toplink.essentials.platform.database.DatabasePlatform { 37 protected Hashtable buildFieldTypes() { 38 Hashtable fieldTypeMapping; 39 40 fieldTypeMapping = new Hashtable(); 41 fieldTypeMapping.put(Boolean .class, new FieldTypeDefinition("NUMBER", 1)); 42 43 fieldTypeMapping.put(Integer .class, new FieldTypeDefinition("NUMBER", 11)); 44 fieldTypeMapping.put(Long .class, new FieldTypeDefinition("NUMBER", 19)); 45 fieldTypeMapping.put(Float .class, new FieldTypeDefinition("NUMBER", 12, 5).setLimits(19, 0, 19)); 46 fieldTypeMapping.put(Double .class, new FieldTypeDefinition("NUMBER", 10, 5).setLimits(19, 0, 19)); 47 fieldTypeMapping.put(Short .class, new FieldTypeDefinition("NUMBER", 6)); 48 fieldTypeMapping.put(Byte .class, new FieldTypeDefinition("NUMBER", 4)); 49 fieldTypeMapping.put(java.math.BigInteger .class, new FieldTypeDefinition("NUMBER", 19)); 50 fieldTypeMapping.put(java.math.BigDecimal .class, new FieldTypeDefinition("NUMBER", 19).setLimits(19, 0, 9)); 51 fieldTypeMapping.put(Number .class, new FieldTypeDefinition("NUMBER", 19).setLimits(19, 0, 9)); 52 53 fieldTypeMapping.put(String .class, new FieldTypeDefinition("CHAR", 255)); 54 fieldTypeMapping.put(Character .class, new FieldTypeDefinition("CHAR", 1)); 55 56 fieldTypeMapping.put(Byte [].class, new FieldTypeDefinition("BINARY")); 57 fieldTypeMapping.put(Character [].class, new FieldTypeDefinition("MEMO")); 58 fieldTypeMapping.put(byte[].class, new FieldTypeDefinition("BINARY")); 59 fieldTypeMapping.put(char[].class, new FieldTypeDefinition("MEMO")); 60 fieldTypeMapping.put(java.sql.Blob .class, new FieldTypeDefinition("BINARY")); 61 fieldTypeMapping.put(java.sql.Clob .class, new FieldTypeDefinition("MEMO")); 62 63 fieldTypeMapping.put(java.sql.Date .class, new FieldTypeDefinition("DATE", false)); 64 fieldTypeMapping.put(java.sql.Time .class, new FieldTypeDefinition("CHAR", 15)); 65 fieldTypeMapping.put(java.sql.Timestamp .class, new FieldTypeDefinition("CHAR", 25)); 66 67 return fieldTypeMapping; 68 } 69 70 75 public Object convertToDatabaseType(Object value) { 76 Object dbValue = super.convertToDatabaseType(value); 77 if ((dbValue instanceof java.sql.Time ) || (dbValue instanceof java.sql.Timestamp )) { 78 return dbValue.toString(); 79 } 80 return dbValue; 81 } 82 83 88 public int getMaxFieldNameSize() { 89 return 10; 90 } 91 92 95 public String getSelectForUpdateString() { 96 return " FOR UPDATE OF *"; 97 } 98 99 public boolean isDBase() { 100 return true; 101 } 102 103 109 public Hashtable maximumNumericValues() { 110 Hashtable values = new Hashtable(); 111 112 values.put(Integer .class, new Integer (Integer.MAX_VALUE)); 113 values.put(Long .class, Long.valueOf("922337203685478000")); 114 values.put(Double .class, new Double ("99999999.999999999")); 115 values.put(Short .class, new Short (Short.MIN_VALUE)); 116 values.put(Byte .class, new Byte (Byte.MIN_VALUE)); 117 values.put(Float .class, new Float ("99999999.999999999")); 118 values.put(java.math.BigInteger .class, new java.math.BigInteger ("922337203685478000")); 119 values.put(java.math.BigDecimal .class, new java.math.BigDecimal ("999999.999999999")); 120 return values; 121 } 122 123 129 public Hashtable minimumNumericValues() { 130 Hashtable values = new Hashtable(); 131 132 values.put(Integer .class, new Integer (Integer.MIN_VALUE)); 133 values.put(Long .class, Long.valueOf("-922337203685478000")); 134 values.put(Double .class, new Double ("-99999999.999999999")); 135 values.put(Short .class, new Short (Short.MIN_VALUE)); 136 values.put(Byte .class, new Byte (Byte.MIN_VALUE)); 137 values.put(Float .class, new Float ("-99999999.999999999")); 138 values.put(java.math.BigInteger .class, new java.math.BigInteger ("-922337203685478000")); 139 values.put(java.math.BigDecimal .class, new java.math.BigDecimal ("-999999.999999999")); 140 return values; 141 } 142 143 147 public void printFieldNotNullClause(Writer writer) { 148 } 150 151 155 public boolean shouldUseJDBCOuterJoinSyntax() { 156 return false; 157 } 158 159 162 public boolean supportsForeignKeyConstraints() { 163 return false; 164 } 165 166 169 public boolean supportsPrimaryKeyConstraint() { 170 return false; 171 } 172 } 173 | Popular Tags |