Ejemplo n.º 1
0
        public byte[] SelAttachBlob(string attachId)
        {
            _logger.Debug("SelAttachBlob.");
            if (string.IsNullOrEmpty(attachId))
            {
                throw new ArgumentNullException("AttachId param can not be null.");
            }
            _logger.Debug("Params: attachId = {0};", attachId);

            OraCommand command = new OraCommand("REQ_PKG.SEL_REQ_ATT_BLOB");

            command.CommandType = CommandType.StoredProcedure;
            OraParamBLOB returnParam = new OraParamBLOB("return", ParameterDirection.ReturnValue, (byte[])null);

            command.AddDBParam(returnParam);
            command.AddDBParam(new OraParamInt32("p_reqAtt_id", ParameterDirection.Input, Convert.ToInt32(attachId)));
            Execute(command);

            return(returnParam.ParamValue);
        }
Ejemplo n.º 2
0
        public void TestFuncOutParams()
        {
            using (IDbConnection conn = new OraConnection())
            {
                conn.OpenConnection("chipanddale", "chipanddale", "xe");
                IDbMgr dbManager = new OraDBMgr(conn, _LogMgr);

                // function FuncOutParams (p_int32 out number, p_double out number, p_date out date, p_string out varchar2, p_clob out clob, p_blob out blob) return blob;
                IDbCommand command = new OraCommand("test_pkg.FuncOutParams");
                command.CommandType = System.Data.CommandType.StoredProcedure;

                OraParamBLOB returnParam = new OraParamBLOB("return", System.Data.ParameterDirection.ReturnValue, (byte[])null);
                command.AddDBParam(returnParam);
                command.AddDBParam(new OraParamInt32("p_int32", System.Data.ParameterDirection.Output, null));
                command.AddDBParam(new OraParamDouble("p_double", System.Data.ParameterDirection.Output, null));
                command.AddDBParam(new OraParamDateTime("p_date", System.Data.ParameterDirection.Output, null));
                command.AddDBParam(new OraParamString("p_string", System.Data.ParameterDirection.Output, null, 2000));
                command.AddDBParam(new OraParamCLOB("p_clob", System.Data.ParameterDirection.Output, null));
                command.AddDBParam(new OraParamBLOB("p_blob", System.Data.ParameterDirection.Output, (byte[])null));

                using (DbTransaction transaction = new DbTransaction(dbManager))
                {
                    dbManager.Execute(command);
                    transaction.Success = true;
                }

                byte[] blob = returnParam.ParamValue;
                Debug.Assert(blob != null, "returnParam");
                Debug.Assert(command.Params["p_int32"].GetValue() != null, "p_int32");
                Debug.Assert(command.Params["p_double"].GetValue() != null, "p_double");
                Debug.Assert(command.Params["p_date"].GetValue() != null, "p_date");
                Debug.Assert(command.Params["p_string"].GetValue() != null, "p_string");
                Debug.Assert(command.Params["p_clob"].GetValue() != null, "p_clob");
                Debug.Assert(command.Params["p_blob"].GetValue() != null, "p_blob");
            }
        }