コード例 #1
0
        /// <summary>
        /// 스토어 프로시져를 실행 합니다..
        /// </summary>
        /// <param name="spName"></param>
        /// <param name="Params"></param>
        /// <param name="intLob_ParamCnt"></param>
        /// <param name="fi"></param>
        /// <param name="evtP"></param>
        public void Excute_StoredProcedure(string spName, OracleParameter[] Params, int intLob_ParamCnt, FileInfo fi, delExcuteProcedure_Progress evtP)
        {
            int Count = 0;

            while (this.retryTimes_Query >= Count)
            {
                try
                {
                    Count++;

                    excute_StoredProcedure(spName, Params, intLob_ParamCnt, fi, evtP);

                    return;
                }
                catch (Exception ex)
                {
                    if (Count == this.RetryTimes_Query)
                    {
                        throw new Exception(ex.Message, ex);
                    }
                    Thread.Sleep(retrySleepTime);
                }
            }
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="spName"></param>
        /// <param name="Params"></param>
        /// <param name="intLob_ParamCnt"></param>
        /// <param name="fi"></param>
        /// <param name="evtP"></param>
        private void excute_StoredProcedure(string spName, OracleParameter[] Params, int intLob_ParamCnt, FileInfo fi, delExcuteProcedure_Progress evtP)
        {
            try
            {
                this.DB_isOpen();

                if (spName.Trim() == "")
                {
                    throw new Exception("프로시져 이름이 공백 입니다.");
                }

                Dbcmd.Parameters.Clear();
                this.Dbcmd.Connection = this.Dbconn;
                Dbcmd.CommandType     = CommandType.StoredProcedure;
                Dbcmd.CommandText     = spName;

                foreach (OracleParameter param in Params)
                {
                    Dbcmd.Parameters.Add(param);
                }

                OracleBlob Lob = new OracleBlob(Dbconn);

                int intBlockSize = 15000;
                //int intFileSize = Convert.ToInt32(fi.Length);


                FileStream   fs = new FileStream(fi.FullName, FileMode.Open, FileAccess.Read);
                BinaryReader br = new BinaryReader(fs);

                try
                {
                    byte[] bytes = new byte[intBlockSize];

                    int intBytes;
                    int intTotalBytes = 0;

                    while ((intBytes = br.Read(bytes, 0, bytes.Length)) > 0)
                    {
                        Lob.Write(bytes, 0, intBytes);

                        intTotalBytes += intBytes;

                        if (evtP != null)
                        {
                            evtP(int.Parse(fi.Length.ToString()), intTotalBytes);
                        }
                    }
                }
                catch
                {
                    throw;
                }
                finally
                {
                    br.Close();
                    fs.Close();

                    fs.Dispose();
                }

                Dbcmd.Parameters[intLob_ParamCnt].Value = Lob;  //DBNull.Value;	//Lob;

                Dbcmd.ExecuteNonQuery();
            }
            catch (OracleException ex)
            {
                throw new Exception(string.Format("SP 실행 Err(Oracle) : {0} / SP : {1}", ex.Message, spName), ex);
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("DB Open Err(일반) : {0}", ex.Message), ex);
            }
            finally
            {
                if (!this.isTaransaction)
                {
                    this.DB_Close();
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// 스토어 프로시져를 실행 합니다..
        /// </summary>
        /// <param name="spName"></param>
        /// <param name="Params"></param>
        /// <param name="intLob_ParamCnt"></param>
        /// <param name="fi"></param>
        /// <param name="evtP"></param>
        public void Excute_StoredProcedure(string spName, OracleParameter[] Params, int intLob_ParamCnt, FileInfo fi, delExcuteProcedure_Progress evtP, bool writelog = false)
        {
            int Count = 0;

            while (this.retryTimes_Query >= Count)
            {
                try
                {
                    Count++;

                    excute_StoredProcedure(spName, Params, intLob_ParamCnt, fi, evtP, writelog);

                    return;
                }
                catch (Exception ex)
                {
                    if (Log != null & writelog)
                    {
                        Log.WLog_Exception(string.Format("SQLDB.Excute_Query[{0}번째", Count), ex);
                    }
                    if (Count == this.RetryTimes_Query)
                    {
                        throw new Exception(ex.Message, ex);
                    }
                    Thread.Sleep(retrySleepTime);
                }
            }
        }