| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- package xin.glue.ui.B.common;
- import java.sql.CallableStatement;
- import java.sql.SQLException;
- import java.util.ArrayList;
- import com.posdata.glue.biz.activity.PosActivity;
- import com.posdata.glue.biz.constants.PosBizControlConstants;
- import com.posdata.glue.context.PosContext;
- import com.posdata.glue.dao.PosGenericDao;
- import com.posdata.glue.dao.vo.PosParameter;
- /**
- *
- * @Description 调用存储过程
- * @author 梅贵平{meiguiping}
- * @date 2011-01-07 下午07:42:42
- * @JDK Version jdk1.4.2
- */
- public class XgSimpleProc extends PosActivity
- {
- public String runActivity(PosContext context)
- {
- PosGenericDao dao = this.getDao("mesdao");
- CallableStatement cstm = null;
-
- String sql = this.getProperty("sqlkey");
- int count = Integer.parseInt(this.getProperty("paramCount"));
- String[]procStat= (String[])context.get("procStat");
- if(procStat == null) return PosBizControlConstants.SUCCESS;
- int len = procStat.length;
- try
- {
- for(int j = 0; j < len ; j++)
- {
- cstm = dao.getCallableStatement(sql);
- String inParam = "";
- //int index = 1;
- for(int i = 1; i <= count ; i++)
- {
- inParam = this.getProperty("InParam"+i);
- if (inParam != null )
- {
- cstm.setString(i, ((String[])context.get(inParam))[j]);
- }
- else
- {
- cstm.registerOutParameter(i, java.sql.Types.VARBINARY);
- }
- }
- cstm.execute();
- }
-
- }catch(Exception ex)
- {
- logger.logError(ex.getMessage(), ex);
- }
- finally
- {
- if (cstm != null)
- {
- try
- {
- cstm.close();
- }
- catch (SQLException e)
- {
- logger.logWarn(e.getMessage(), e);
- }
- }
- }
- return PosBizControlConstants.SUCCESS;
- }
- }
|