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 BooleanTypeHandler extends BaseTypeHandler implements TypeHandler { 27 28 public void setParameter(PreparedStatement ps, int i, Object parameter, String jdbcType) 29 throws SQLException { 30 ps.setBoolean(i, ((Boolean ) parameter).booleanValue()); 31 } 32 33 public Object getResult(ResultSet rs, String columnName) 34 throws SQLException { 35 boolean b = rs.getBoolean(columnName); 36 if (rs.wasNull()) { 37 return null; 38 } else { 39 return new Boolean (b); 40 } 41 } 42 43 public Object getResult(ResultSet rs, int columnIndex) 44 throws SQLException { 45 boolean b = rs.getBoolean(columnIndex); 46 if (rs.wasNull()) { 47 return null; 48 } else { 49 return new Boolean (b); 50 } 51 } 52 53 public Object getResult(CallableStatement cs, int columnIndex) 54 throws SQLException { 55 boolean b = cs.getBoolean(columnIndex); 56 if (cs.wasNull()) { 57 return null; 58 } else { 59 return new Boolean (b); 60 } 61 } 62 63 public Object valueOf(String s) { 64 return Boolean.valueOf(s); 65 } 66 67 68 } 69 | Popular Tags |