1 package org.apache.torque.adapter; 2 3 21 22 import java.sql.Connection ; 23 import java.sql.SQLException ; 24 import java.sql.Timestamp ; 25 import java.util.Date ; 26 27 import org.apache.torque.TorqueException; 28 import org.apache.torque.util.Query; 29 30 61 public abstract class AbstractDBAdapter implements DB 62 { 63 66 protected AbstractDBAdapter() 67 { 68 } 69 70 76 public abstract String toUpperCase(String in); 77 78 85 public char getStringDelimiter() 86 { 87 return '\''; 88 } 89 90 97 public abstract String getIDMethodType(); 98 99 107 public abstract String getIDMethodSQL(Object obj); 108 109 116 public abstract void lockTable(Connection con, String table) 117 throws SQLException ; 118 119 126 public abstract void unlockTable(Connection con, String table) 127 throws SQLException ; 128 129 135 public abstract String ignoreCase(String in); 136 137 146 public String ignoreCaseInOrderBy(String in) 147 { 148 return ignoreCase(in); 149 } 150 151 158 public boolean supportsNativeLimit() 159 { 160 return false; 161 } 162 163 171 public boolean supportsNativeOffset() 172 { 173 return false; 174 } 175 176 186 public void generateLimits(Query query, int offset, int limit) 187 throws TorqueException 188 { 189 if (supportsNativeLimit()) 190 { 191 query.setLimit(String.valueOf(limit)); 192 } 193 } 194 195 202 203 public boolean escapeText() 204 { 205 return true; 206 } 207 208 215 public int getLimitStyle() 216 { 217 return LIMIT_STYLE_NONE; 218 } 219 220 227 public String getDateString(Date date) 228 { 229 Timestamp ts = null; 230 if (date instanceof Timestamp ) 231 { 232 ts = (Timestamp ) date; 233 } 234 else 235 { 236 ts = new Timestamp (date.getTime()); 237 } 238 239 return ("{ts '" + ts + "'}"); 240 } 241 242 248 public String getBooleanString(Boolean b) 249 { 250 return (Boolean.TRUE.equals(b) ? "1" : "0"); 251 } 252 253 262 public boolean useIlike() 263 { 264 return false; 265 } 266 267 277 public boolean useEscapeClauseForLike() 278 { 279 return false; 280 } 281 } 282 | Popular Tags |