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