1 package org.apache.torque.engine.platform; 2 3 18 19 import java.util.Hashtable ; 20 import java.util.Iterator ; 21 import java.util.Map ; 22 23 import org.apache.torque.engine.database.model.Domain; 24 import org.apache.torque.engine.database.model.SchemaType; 25 26 27 33 public class PlatformDefaultImpl implements Platform 34 { 35 private Map schemaDomainMap; 36 37 40 public PlatformDefaultImpl() 41 { 42 initialize(); 43 } 44 45 private void initialize() 46 { 47 schemaDomainMap = new Hashtable (30); 48 Iterator iter = SchemaType.iterator(); 49 while (iter.hasNext()) 50 { 51 SchemaType type = (SchemaType) iter.next(); 52 schemaDomainMap.put(type, new Domain(type)); 53 } 54 schemaDomainMap.put(SchemaType.BOOLEANCHAR, 55 new Domain(SchemaType.BOOLEANCHAR, "CHAR")); 56 schemaDomainMap.put(SchemaType.BOOLEANINT, 57 new Domain(SchemaType.BOOLEANINT, "INTEGER")); 58 } 59 60 protected void setSchemaDomainMapping(Domain domain) 61 { 62 schemaDomainMap.put(domain.getType(), domain); 63 } 64 65 68 public int getMaxColumnNameLength() 69 { 70 return 64; 71 } 72 73 76 public String getNativeIdMethod() 77 { 78 return Platform.IDENTITY; 79 } 80 81 84 public Domain getDomainForSchemaType(SchemaType jdbcType) 85 { 86 return (Domain) schemaDomainMap.get(jdbcType); 87 } 88 89 94 public String getNullString(boolean notNull) 95 { 96 return (notNull ? "NOT NULL" : ""); 99 } 100 101 104 public String getAutoIncrement() 105 { 106 return "IDENTITY"; 107 } 108 109 113 public boolean hasScale(String sqlType) 114 { 115 return true; 116 } 117 118 122 public boolean hasSize(String sqlType) 123 { 124 return true; 125 } 126 127 } 128 | Popular Tags |