1 25 package org.jresearch.gossip.dao.drivers.generic; 26 27 import java.math.BigDecimal ; 28 import java.sql.SQLException ; 29 import java.util.Date ; 30 31 import org.jresearch.gossip.dao.drivers.DbDriver; 32 33 39 public class GenericSqlDriver extends DbDriver { 40 41 44 public GenericSqlDriver() { 45 this.queries = new GenericSqlQueries(); 46 } 47 48 51 public Object mapObjectType(Object object) throws ClassCastException { 52 if (null == object) 53 return null; 54 if (object instanceof BigDecimal ) { 56 return new Integer (((BigDecimal ) object).intValue()); 57 } 58 if (object instanceof oracle.sql.TIMESTAMP) { 59 try { 60 return new Date (((oracle.sql.TIMESTAMP) object) 61 .timestampValue().getTime()); 62 } catch (SQLException sqle) { 63 throw new ClassCastException ( 64 "Can't convert oracle.sql.TIMESTAMP to java.util.Date" 65 + sqle.getLocalizedMessage()); 66 } 67 } 68 return object; 70 } 71 72 public static final String VENDOR_ORACLE = "oracle"; 73 74 80 public int getLastRowIdx(int startIdx, int length) { 81 return startIdx + length; 82 } 83 } 84 | Popular Tags |