1 16 package com.ibatis.sqlmap.engine.type; 17 18 import java.sql.CallableStatement ; 19 import java.sql.PreparedStatement ; 20 import java.sql.ResultSet ; 21 import java.sql.SQLException ; 22 23 26 public class IntegerTypeHandler extends BaseTypeHandler implements TypeHandler { 27 28 public void setParameter(PreparedStatement ps, int i, Object parameter, String jdbcType) 29 throws SQLException { 30 ps.setInt(i, ((Integer ) parameter).intValue()); 31 } 32 33 public Object getResult(ResultSet rs, String columnName) 34 throws SQLException { 35 int i = rs.getInt(columnName); 36 if (rs.wasNull()) { 37 return null; 38 } else { 39 return new Integer (i); 40 } 41 } 42 43 public Object getResult(ResultSet rs, int columnIndex) 44 throws SQLException { 45 int i = rs.getInt(columnIndex); 46 if (rs.wasNull()) { 47 return null; 48 } else { 49 return new Integer (i); 50 } 51 } 52 53 public Object getResult(CallableStatement cs, int columnIndex) 54 throws SQLException { 55 int i = cs.getInt(columnIndex); 56 if (cs.wasNull()) { 57 return null; 58 } else { 59 return new Integer (i); 60 } 61 } 62 63 public Object valueOf(String s) { 64 return Integer.valueOf(s); 65 } 66 67 } 68 | Popular Tags |