1 21 package oracle.toplink.essentials.platform.database; 23 24 import java.io.*; 25 import java.util.*; 26 import oracle.toplink.essentials.expressions.*; 27 import oracle.toplink.essentials.internal.databaseaccess.*; 28 import oracle.toplink.essentials.internal.sessions.AbstractSession; 29 30 35 public class AccessPlatform extends oracle.toplink.essentials.platform.database.DatabasePlatform { 36 protected Hashtable buildClassTypes() { 37 Hashtable classTypeMapping = super.buildClassTypes(); 38 39 classTypeMapping.put("LONG", Long .class); 41 classTypeMapping.put("TEXT", String .class); 42 43 return classTypeMapping; 44 } 45 46 protected Hashtable buildFieldTypes() { 47 Hashtable fieldTypeMapping; 48 49 fieldTypeMapping = new Hashtable(); 50 fieldTypeMapping.put(Boolean .class, new FieldTypeDefinition("BIT", false)); 51 52 fieldTypeMapping.put(Integer .class, new FieldTypeDefinition("LONG", false)); 53 fieldTypeMapping.put(Long .class, new FieldTypeDefinition("DOUBLE", false)); 54 fieldTypeMapping.put(Float .class, new FieldTypeDefinition("DOUBLE", false)); 55 fieldTypeMapping.put(Double .class, new FieldTypeDefinition("DOUBLE", false)); 56 fieldTypeMapping.put(Short .class, new FieldTypeDefinition("SHORT", false)); 57 fieldTypeMapping.put(Byte .class, new FieldTypeDefinition("BYTE", false)); 58 fieldTypeMapping.put(java.math.BigInteger .class, new FieldTypeDefinition("DOUBLE", false)); 59 fieldTypeMapping.put(java.math.BigDecimal .class, new FieldTypeDefinition("DOUBLE", false)); 60 fieldTypeMapping.put(Number .class, new FieldTypeDefinition("DOUBLE", false)); 61 62 fieldTypeMapping.put(String .class, new FieldTypeDefinition("TEXT", 255)); 63 fieldTypeMapping.put(Character .class, new FieldTypeDefinition("TEXT", 1)); 64 65 fieldTypeMapping.put(Byte [].class, new FieldTypeDefinition("LONGBINARY", false)); 66 fieldTypeMapping.put(Character [].class, new FieldTypeDefinition("MEMO", false)); 67 fieldTypeMapping.put(byte[].class, new FieldTypeDefinition("LONGBINARY", false)); 68 fieldTypeMapping.put(char[].class, new FieldTypeDefinition("MEMO", false)); 69 fieldTypeMapping.put(java.sql.Blob .class, new FieldTypeDefinition("LONGBINARY", false)); 70 fieldTypeMapping.put(java.sql.Clob .class, new FieldTypeDefinition("MEMO", false)); 71 72 fieldTypeMapping.put(java.sql.Date .class, new FieldTypeDefinition("DATETIME", false)); 73 fieldTypeMapping.put(java.sql.Time .class, new FieldTypeDefinition("DATETIME", false)); 74 fieldTypeMapping.put(java.sql.Timestamp .class, new FieldTypeDefinition("DATETIME", false)); 75 76 return fieldTypeMapping; 77 } 78 79 84 public int getMaxFieldNameSize() { 85 return 64; 86 } 87 88 92 public java.sql.Timestamp getTimestampFromServer(AbstractSession session, String sessionName) { 93 if (getTimestampQuery() == null) { 94 java.sql.Timestamp currentTime = new java.sql.Timestamp (System.currentTimeMillis()); 95 currentTime.setNanos(0); 96 return currentTime; 97 } else { 98 getTimestampQuery().setSessionName(sessionName); 99 return (java.sql.Timestamp )session.executeQuery(getTimestampQuery()); 100 } 101 } 102 103 107 protected void initializePlatformOperators() { 108 super.initializePlatformOperators(); 109 110 addOperator(ExpressionOperator.simpleFunction(ExpressionOperator.ToUpperCase, "UCASE")); 111 addOperator(ExpressionOperator.simpleFunction(ExpressionOperator.ToLowerCase, "LCASE")); 112 } 113 114 public boolean isAccess() { 115 return true; 116 } 117 118 124 public Hashtable maximumNumericValues() { 125 Hashtable values = new Hashtable(); 126 127 values.put(Integer .class, new Integer (Integer.MAX_VALUE)); 128 values.put(Long .class, new Long (Long.MAX_VALUE)); 129 values.put(Double .class, new Double (Double.MAX_VALUE)); 130 values.put(Short .class, new Short (Short.MAX_VALUE)); 131 values.put(Byte .class, new Byte (Byte.MAX_VALUE)); 132 values.put(Float .class, new Float (123456789)); 133 values.put(java.math.BigInteger .class, new java.math.BigInteger ("999999999999999")); 134 values.put(java.math.BigDecimal .class, new java.math.BigDecimal ("99999999999999999999.9999999999999999999")); 135 return values; 136 } 137 138 144 public Hashtable minimumNumericValues() { 145 Hashtable values = new Hashtable(); 146 147 values.put(Integer .class, new Integer (Integer.MIN_VALUE)); 148 values.put(Long .class, new Long (Long.MIN_VALUE)); 149 values.put(Double .class, new Double (Double.MIN_VALUE)); 150 values.put(Short .class, new Short (Short.MIN_VALUE)); 151 values.put(Byte .class, new Byte (Byte.MIN_VALUE)); 152 values.put(Float .class, new Float (-123456789)); 153 values.put(java.math.BigInteger .class, new java.math.BigInteger ("-999999999999999")); 154 values.put(java.math.BigDecimal .class, new java.math.BigDecimal ("-9999999999999999999.9999999999999999999")); 155 return values; 156 } 157 158 162 public void printFieldNotNullClause(Writer writer) { 163 } 165 166 170 public boolean requiresNamedPrimaryKeyConstraints() { 171 return true; 172 } 173 174 178 public boolean shouldUseJDBCOuterJoinSyntax() { 179 return false; 180 } 181 } 182 | Popular Tags |