package org.jfox.dao.mapping;

import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @author <a href="mailto:yangyong@ufsoft.com.cn">Young Yang</a>
 */

public class BinaryStreamColumnMapping extends ColumnMapping {

    public BinaryStreamColumnMapping(String columnName, Class type) {
        super(columnName, type);
    }

    public void doFillStatement(PreparedStatement pst, Object value, int index) throws SQLException, IllegalAccessException, InvocationTargetException {
        pst.setBinaryStream(index,(InputStream)value,0);
    }

    public void doFillObject(Object pObject, ResultSet rset) throws SQLException, IllegalAccessException, InvocationTargetException {
        getSetterMethod().invoke(pObject,new Object[]{rset.getBinaryStream(getColumnName())});
    }

    public static void main(String[] args) {

    }
}

