Beispiel #1
0
 /// <summary>
 /// constructor
 /// </summary>
 /// <param name="events">Isag events</param>
 /// <param name="conn">Main sql connection</param>
 /// <param name="isagCustomProperties">components custom properties</param>
 /// <param name="dbCommand">Database command type</param>
 /// <param name="bulkConn">Bulk csql connection</param>
 /// <param name="componentMetaData">SSIS component metadata</param>
 public TxAll(IsagEvents events, SqlConnection conn,
              IsagCustomProperties isagCustomProperties, TlDbCommand dbCommand, SqlConnection bulkConn,
              IDTSComponentMetaData100 componentMetaData)
 {
     _events = events;
     _conn   = conn;
     _IsagCustomProperties = isagCustomProperties;
     _dbCommand            = dbCommand;
     _bulkConn             = bulkConn;
     _componentMetaData    = componentMetaData;
 }
        /// <summary>
        /// PreExecute phase: Gather all needed informations
        /// </summary>
        public override void PreExecute()
        {
            _status = new Status(_events);
            _status.AddTableLoaderStatus(Status.TableLoaderStatusType.started);
            _status.AddTableLoaderStatus(Status.TableLoaderStatusType.preExecStarted);

            if (_IsagCustomProperties == null || _events == null)
            {
                InitProperties(true);
            }

            _chunkCounterBulk = 1;
            _dbCommand        = new TlDbCommand(_IsagCustomProperties, _events, ComponentMetaData, VariableDispenser);

            if (_IsagCustomProperties.UseMultiThreading)
            {
                CreateThreadHandler();
            }
            else
            {
                _txAll = new TxAll(_events, Conn, _IsagCustomProperties, _dbCommand, BulkConn, ComponentMetaData);
                if (!_IsagCustomProperties.ExcludePreSqlFromTransaction)
                {
                    _txAll.CreateTransaction();
                }
                _chunkCounterDbCommand = 1;
                _tempTableName         = _txAll.GetTempTableName();
                _txAll.CreateTempTable(_tempTableName);
            }

            CreateMapping();

            IDTSInput100 input = this.ComponentMetaData.InputCollection[Constants.INPUT_NAME];

            if (_IsagCustomProperties.UseTempTable)
            {
                _dtBuffer = CreateDataTableForTempTable(input);
            }
            else if (_IsagCustomProperties.UseMultiThreading)
            {
                _dtBuffer = CreateDataTableForDestinationTable();
            }
            else
            {
                _dtBuffer = CreateDataTableForDestinationTable(_txAll.Transaction);
            }

            if (!_IsagCustomProperties.UseMultiThreading)
            {
                _txAll.DtBuffer = _dtBuffer;
            }

            _status.AddTableLoaderStatus(Status.TableLoaderStatusType.preExecFinished);
        }