1 package org.apache.torque.adapter; 2 3 21 22 import java.sql.Connection ; 23 import java.sql.SQLException ; 24 import java.sql.Statement ; 25 import java.util.Date ; 26 import java.text.SimpleDateFormat ; 27 28 34 public class DBInterbase extends AbstractDBAdapter 35 { 36 39 private static final long serialVersionUID = -6709312389168248070L; 40 41 44 private static final String DATE_FORMAT = "yyyy-MM-dd HH:MM:ss"; 45 46 52 public String toUpperCase(String in) 53 { 54 return new StringBuffer ("UPPER(").append(in).append(")").toString(); 55 } 56 57 63 public String ignoreCase(String in) 64 { 65 return new StringBuffer ("UPPER(").append(in).append(")").toString(); 66 } 67 68 77 public String ignoreCaseInOrderBy(String in) 78 { 79 return in; 80 } 81 82 85 public String getIDMethodType() 86 { 87 return NO_ID_METHOD; 88 } 89 90 93 public String getIDMethodSQL(Object obj) 94 { 95 return null; 96 } 97 98 105 public void lockTable(Connection con, String table) throws SQLException 106 { 107 Statement statement = con.createStatement(); 108 109 StringBuffer stmt = new StringBuffer (); 110 stmt.append("SET TRANSACTION ") 111 .append("ISOLATION LEVEL READ COMMITTED ") 112 .append("NO RECORD_VERSION WAIT ") 113 .append("RESERVING ") 114 .append(table) 115 .append(" FOR PROTECTED WRITE"); 116 117 statement.executeQuery(stmt.toString()); 118 } 119 120 127 public void unlockTable(Connection con, String table) throws SQLException 128 { 129 con.commit(); 133 } 134 135 136 144 public String getDateString(Date date) 145 { 146 char delim = getStringDelimiter(); 147 return (delim + new SimpleDateFormat (DATE_FORMAT).format(date) + delim); 148 } 149 150 158 public boolean escapeText() 159 { 160 return false; 161 } 162 163 172 public boolean useEscapeClauseForLike() 173 { 174 return true; 175 } 176 } 177 | Popular Tags |