Code example for PreparedStatement

Methods: setDate, setDouble, setNString

0
public class GCOsqlUtil { 
 
	 
	public static PreparedStatement prepareStatementGCOpriceReady(PreparedStatement ps, GCOprice price) throws SQLException {
		 
		ps.setNString(	1, 	String.valueOf(price.getTYPE())); 
		ps.setNString(	2, 	String.valueOf(price.getSYMBOL())); 
         
		if (price.getCUSIP()!= null) {
    			ps.setNString(  3,  price.getCUSIP());
    	} else { 
        	ps.setNString(  3,  null);
    	} 
		 
		if (price.getNAME()!= null) {
    			ps.setNString(  4,  price.getNAME());
    	} else { 
        	ps.setNString(  4,  null);
    	} 
		 
		ps.setDouble(			5, price.getCLOSE_PRICE());
		ps.setDate(			6, price.getSQL_SOURCE_DATE());
	     
		return ps;	
	}