コード例 #1
0
        /// <summary>
        /// Creates temporary table
        /// </summary>
        /// <param name="tempTableName">temporary table name</param>
        public void CreateTempTable(string tempTableName)
        {
            IDTSInput100 input = _componentMetaData.InputCollection[Constants.INPUT_NAME];
            string       templateCreateTempTable = SqlCreator.GetCreateTempTable(_IsagCustomProperties, Constants.TEMP_TABLE_PLACEHOLDER_BRACKETS);
            string       sqlCreateTempTable      = templateCreateTempTable.Replace(Constants.TEMP_TABLE_PLACEHOLDER_BRACKETS, tempTableName);

            if (!_IsagCustomProperties.UseBulkInsert)
            {
                SqlExecutor.ExecSql(sqlCreateTempTable, _bulkConn, _IsagCustomProperties.TimeOutDb, _dbTransaction);
            }
        }
コード例 #2
0
        /// <summary>
        /// Executes pre- oder post execute command
        /// </summary>
        /// <param name="cmdType"> Events.IsagEventType.PreSql oder Events.IsagEventType.PostSql </param>
        private void ExecPreOrPostExecuteStatement(IsagEvents.IsagEventType cmdType)
        {
            string sql         = "";
            string cmdTypeName = "";

            try
            {
                if (cmdType == IsagEvents.IsagEventType.PreSql && _IsagCustomProperties.HasPreSql)
                {
                    sql         = _dbCommand.GetExecuteStatementFromTemplate(_IsagCustomProperties.PreSql);
                    cmdTypeName = "PreSql";
                }
                else if (cmdType == IsagEvents.IsagEventType.PostSql && _IsagCustomProperties.HasPostSql)
                {
                    sql         = _dbCommand.GetExecuteStatementFromTemplate(_IsagCustomProperties.PostSql);
                    cmdTypeName = "PostSql";
                }
                else if (cmdType != IsagEvents.IsagEventType.PreSql && cmdType != IsagEvents.IsagEventType.PostSql)
                {
                    throw new Exception("Unknown CommandType in ExecPrePostExecuteStatement: " + cmdType);
                }

                // execute pre- oder post execute command

                if (sql.Length > 0)
                {
                    SqlTransaction transaction  = _IsagCustomProperties.UseMultiThreading ? null : _txAll.Transaction;
                    int            rowsAffected = SqlExecutor.ExecSql(sql, Conn, _IsagCustomProperties.TimeOutDb, transaction);
                    _events.Fire(IsagEvents.IsagEventType.Sql,
                                 "[ExecSql:" + cmdType.ToString() + "]: {0} rows were affected by the Sql Command.",
                                 new string[] { rowsAffected.ToString(), ((int)cmdType).ToString() });
                    _events.Fire(cmdType, cmdTypeName + " Statement has been executed.");
                }
            }
            catch (Exception ex)
            {
                _events.FireError(new string[] { cmdTypeName, ex.Message });
                throw;
            }
        }