DHC log 2009-2-17

        今天北京居然下起了小雪,惬意,心情很爽,一天不困.

 

        上午11点左右开始有活干了,一个很久以前就做好了的项目要进行优化,基本上就是把拼凑sql的方式改成sql中参数用?代替,之后再诸如ps.setString(1,"%"+cifno+"%");,最后再update或qurey.

 

        今天下午改了个人征信->客户基本信息->查询客户资料.

 

        CppersoninfoDAO.java 

 

修改了listCppersoninfo()方法 line187


sql = sql+" and cifno like '%"+cifno+"%'"; line196
改成了
sql = sql+" and cifno like ?";             line197


sql=sql+" and idnum like '%"+idnum+"%'";   line201
改成了
sql=sql+" and idnum like ?";               line202

添加了如下代码: line207-line210

/*modify by litao 2009-2-17*/
ps.setString(1, "%"+cifno+"%");//'%"+cifno+"%'
ps.setString(2, "%"+idnum+"%");//'%"+idnum+"%'
/*end by litao*/

 

        cp_selectForPersion_c.jsp

 

将line51
String sql="select cifno ,cifname,idnum from cp_personinfo where cifno like '%"+cifno+"%' and cifname like '%"+cifname+"%' and idnum like '%"+paperwork+"%'" ;
改成了line52
String sql="select cifno ,cifname,idnum from cp_personinfo where cifno like ? and cifname like ? and idnum like ?" ;

line58-line62添加了如下代码:
  /*modify by litao 2009-2-17*/
  ps.setString(1,"%"+cifno+"%");//'%"+cifno+"%'
  ps.setString(2,"%"+cifname+"%");//'%"+cifname+"%'
  ps.setString(3,"%"+paperwork+"%");//'%"+paperwork+"%'
 /*end by litao*/

你可能感兴趣的:(sql,优化,String)