1 package org.hibernate.dialect; 3 4 import java.sql.Types ; 5 6 import org.hibernate.cfg.Environment; 7 8 12 public class InterbaseDialect extends Dialect { 13 14 public InterbaseDialect() { 15 super(); 16 registerColumnType( Types.BIT, "smallint" ); 17 registerColumnType( Types.BIGINT, "numeric(18,0)" ); 18 registerColumnType( Types.SMALLINT, "smallint" ); 19 registerColumnType( Types.TINYINT, "smallint" ); 20 registerColumnType( Types.INTEGER, "integer" ); 21 registerColumnType( Types.CHAR, "char(1)" ); 22 registerColumnType( Types.VARCHAR, "varchar($l)" ); 23 registerColumnType( Types.FLOAT, "float" ); 24 registerColumnType( Types.DOUBLE, "double precision" ); 25 registerColumnType( Types.DATE, "date" ); 26 registerColumnType( Types.TIME, "time" ); 27 registerColumnType( Types.TIMESTAMP, "timestamp" ); 28 registerColumnType( Types.VARBINARY, "blob" ); 29 registerColumnType( Types.NUMERIC, "numeric($p,$s)" ); 30 registerColumnType( Types.BLOB, "blob" ); 31 registerColumnType( Types.CLOB, "blob sub_type 1" ); 32 33 getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, NO_BATCH); 34 } 35 36 public String getAddColumnString() { 37 return "add"; 38 } 39 40 public String getSequenceNextValString(String sequenceName) { 41 return "select " + getSelectSequenceNextValString( sequenceName ) + " from RDB$DATABASE"; 42 } 43 44 public String getSelectSequenceNextValString(String sequenceName) { 45 return "gen_id( " + sequenceName + ", 1 )"; 46 } 47 48 public String getCreateSequenceString(String sequenceName) { 49 return "create generator " + sequenceName; 50 } 51 52 public String getDropSequenceString(String sequenceName) { 53 return "delete from RDB$GENERATORS where RDB$GENERATOR_NAME = '" + sequenceName.toUpperCase() + "'"; 54 } 55 56 public String getQuerySequencesString() { 57 return "select RDB$GENERATOR_NAME from RDB$GENERATORS"; 58 } 59 60 public String getForUpdateString() { 61 return " with lock"; 62 } 63 public String getForUpdateString(String aliases) { 64 return " for update of " + aliases + " with lock"; 65 } 66 67 public boolean supportsSequences() { 68 return true; 69 } 70 71 public boolean supportsLimit() { 72 return true; 73 } 74 75 public String getLimitString(String sql, boolean hasOffset) { 76 return new StringBuffer ( sql.length()+15 ) 77 .append(sql) 78 .append(hasOffset ? " rows ? to ?" : " rows ?") 79 .toString(); 80 } 81 82 public boolean bindLimitParametersFirst() { 83 return false; 84 } 85 86 public boolean bindLimitParametersInReverseOrder() { 87 return false; 88 } 89 90 } | Popular Tags |