/// <summary>
 /// Gets the parameter
 /// </summary>
 /// <returns></returns>
 protected ProcessInfoParameter[] GetParameter()
 {
     ProcessInfoParameter[] retValue = _pi.GetParameter();
     if (retValue == null || retValue.Length == 0)
     {
         ProcessInfoUtil.SetParameterFromDB(_pi, ctxContext);
         retValue = _pi.GetParameter();
     }
     return(retValue);
 }
Esempio n. 2
0
        /// <summary>
        /// Start the DB Process
        /// </summary>
        /// <param name="procedureName">name of the process</param>
        /// <returns></returns>
        ///
#pragma warning disable 612, 618
        private bool StartDBProcess(String procedureName)
        {
            if (DatabaseType.IsPostgre)  //jz Only DB2 not support stored procedure now
            {
                return(false);
            }

            //  execute on this thread/connection
            //String sql = "{call " + procedureName + "(" + _pi.GetAD_PInstance_ID() + ")}";
            OracleConnection conn = null;

            try
            {
                //only oracle procedure are supported
                OracleCommand comm = new OracleCommand();
                conn = (OracleConnection)DataBase.DB.GetConnection();
                conn.Open();
                comm.Connection  = conn;
                comm.CommandText = procedureName;
                comm.CommandType = CommandType.StoredProcedure;
                OracleCommandBuilder.DeriveParameters(comm);
                OracleParameter[] param = new OracleParameter[1];

                foreach (OracleParameter orp in comm.Parameters)
                {
                    param[0] = new OracleParameter(orp.ParameterName, _pi.GetAD_PInstance_ID());
                }

                //log.Fine("Executing " + procedureName + "(" + _pi.GetAD_PInstance_ID() + ")");
                int res = SqlExec.Oracle.OracleHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, procedureName, param);
                conn.Close();
                if (res < 0)
                {
                    ProcessInfoUtil.SetParameterFromDB(_pi);
                    return(StartDBProcess(procedureName, _pi.GetParameter()));
                }

                //DataBase.DB.ExecuteQuery(sql, null);
            }
            catch (Exception e)
            {
                if (conn != null)
                {
                    conn.Close();
                }
                //log.Log(Level.SEVERE, "Error executing procedure " + procedureName, e);
                _pi.SetSummary(Msg.GetMsg(_ctx, "ProcessRunError") + " " + e.Message);
                _pi.SetError(true);
                return(false);
            }
            //	log.fine(Log.l4_Data, "ProcessCtl.startProcess - done");
            return(true);
        }