1 16 package com.ibatis.sqlmap.engine.type; 17 18 import com.ibatis.sqlmap.client.extensions.ParameterSetter; 19 import com.ibatis.sqlmap.client.extensions.ResultGetter; 20 import com.ibatis.sqlmap.client.extensions.TypeHandlerCallback; 21 22 import java.sql.Blob ; 23 import java.sql.SQLException ; 24 25 public class BlobTypeHandlerCallback implements TypeHandlerCallback { 26 27 public Object getResult(ResultGetter getter) throws SQLException { 28 Blob blob = getter.getBlob(); 29 byte[] returnValue = null; 30 if (null != blob) { 31 returnValue = blob.getBytes(1, (int) blob.length()); 32 } else { 33 returnValue = null; 34 } 35 return returnValue; 36 } 37 38 public void setParameter(ParameterSetter setter, Object parameter) 39 throws SQLException { 40 if (null != parameter) { 41 byte[] bytes = (byte[]) parameter; 42 setter.setBytes(bytes); 43 } 44 } 45 46 public Object valueOf(String s) { 47 return s; 48 } 49 50 } | Popular Tags |