/// <summary>
        /// constructor
        /// </summary>
        /// <param name="dbCmdThread">Database command thread</param>
        /// <param name="tempTableName">temporary table name</param>
        /// <param name="dt">Datatable (buffer rows) to write to the temporary table</param>
        /// <param name="sqlTemplateCreateTempTable">Template for creating temprrary table</param>
        /// <param name="timeOutDb">Database timout</param>
        /// <param name="reattempts">Reattempts for failed bulk copys</param>
        /// <param name="threadNr">Thread nummber</param>
        /// <param name="cstr">Connectionstring</param>
        /// <param name="conn">Sql connection</param>
        /// <param name="useTableLock">Use tablock?</param>
        /// <param name="useBulkInsert">Use bulk insert?</param>
        public ThreadBulkCopy(ThreadDbCommand dbCmdThread, string tempTableName, DataTable dt, string sqlTemplateCreateTempTable,
                              int timeOutDb, int reattempts, string threadNr, string cstr, SqlConnection conn, bool useTableLock, bool useBulkInsert)
        {
            _conn = new SqlConnection(cstr);

            _dbCmdThread        = dbCmdThread;
            _tempTableName      = tempTableName;
            _dt                 = dt;
            _sqlCreateTempTable = sqlTemplateCreateTempTable.Replace(Constants.TEMP_TABLE_PLACEHOLDER_BRACKETS, tempTableName);
            _timeoutDb          = timeOutDb;
            _reattempts         = reattempts;
            _threadNr           = threadNr;
            _cstr               = cstr;
            _useTableLock       = useTableLock;
            _useBulkInsert      = useBulkInsert;

            this.DoWork             += new DoWorkEventHandler(ThreadBulkCopy_DoWork);
            this.RunWorkerCompleted += new RunWorkerCompletedEventHandler(ThreadBulkCopy_RunWorkerCompleted);
        }
예제 #2
0
        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="input">SSIS input</param>
        /// <param name="isagCustomProperties">Components custom properties</param>
        /// <param name="cstr">Conectionststring</param>
        /// <param name="conn">Sql connection</param>
        /// <param name="events">Isag events</param>
        /// <param name="dbCommandEventType">Database command event type</param>
        /// <param name="dbCommandTemplate">Database command template</param>
        /// <param name="status"></param>
        public ThreadHandler(IDTSInput100 input, IsagCustomProperties isagCustomProperties,
                             string cstr, SqlConnection conn, IsagEvents events,
                             IsagEvents.IsagEventType dbCommandEventType, string[] dbCommandTemplate, Status status)
        {
            _conn = conn;

            if (dbCommandTemplate != null)
            {
                _dbCmdThread = new ThreadDbCommand(conn, dbCommandEventType, isagCustomProperties.TimeOutDb, isagCustomProperties.Reattempts, dbCommandTemplate);
            }

            _maxAllowdThreads     = isagCustomProperties.MaxThreadCount;
            _input                = input;
            _isagCustomProperties = isagCustomProperties;
            _timeoutDb            = isagCustomProperties.TimeOutDb;
            _reattempts           = isagCustomProperties.Reattempts;
            _cstr   = cstr;
            _events = events;
            _status = status;
        }