Ejemplo n.º 1
0
        public override void Emit(XPathNavigator patternNavigator)
        {
            string containerName = patternNavigator.SelectSingleNode("@Name", VulcanPackage.VulcanConfig.NamespaceManager).Value;
            string helperTableTaskName = "Set Up Helper Table Group "+containerName;

            string helperTableFile = containerName + Resources.ExtensionSQLFile;
            string helperTableFilePath = VulcanPackage.AddFileToProject(helperTableFile);

            File.Delete(helperTableFilePath);

            Connection c = Connection.GetExistingConnection(VulcanPackage, patternNavigator);

            foreach (XPathNavigator nav in patternNavigator.Select("rc:HelperTable", VulcanPackage.VulcanConfig.NamespaceManager))
            {
                string tableName = nav.SelectSingleNode("@Name", VulcanPackage.VulcanConfig.NamespaceManager).Value;
                XPathNavigator tableNavigator = nav.SelectSingleNode("rc:Table",VulcanPackage.VulcanConfig.NamespaceManager);
                Message.Trace(Severity.Debug,"Adding Helper table "+tableName);

                TableHelper th = new TableHelper(tableName, VulcanPackage.VulcanConfig, tableNavigator);
                TableEmitterEx te = new TableEmitterEx(th,VulcanPackage);
                te.Emit(VulcanPackage.QualifiedProjectPath+helperTableFile, true);
            }

            SQLTask setupSQLTask = new SQLTask(VulcanPackage, helperTableTaskName, helperTableTaskName, ParentContainer,c);
            setupSQLTask.TransmuteToFileTask(helperTableFile);

            this.ExecuteDuringDesignTime(patternNavigator, setupSQLTask.SQLTaskHost);

            this.FirstExecutableGeneratedByPattern = setupSQLTask.SQLTaskHost;
            this.LastExecutableGeneratedByPattern = this.FirstExecutableGeneratedByPattern;
        }
Ejemplo n.º 2
0
        public override void Emit(XPathNavigator patternNavigator)
        {
            if (patternNavigator != null)
            {
                string name = patternNavigator.SelectSingleNode("@Name").Value;

                string fileName =
                    Resources.Create+
                    name +
                    Resources.ExtensionSQLFile;

                string filePath = VulcanPackage.AddFileToProject(fileName);

                TableHelper th = new TableHelper(name, VulcanPackage.VulcanConfig, patternNavigator.SelectSingleNode("rc:Table",VulcanPackage.VulcanConfig.NamespaceManager));
                th.TraceHelper();

                th.TraceHelper();

                TableEmitterEx tex = new TableEmitterEx(th, VulcanPackage);

                tex.Emit(filePath,false);
                Connection connection = Connection.GetExistingConnection(VulcanPackage, patternNavigator);
                SQLTask sqlTask = new SQLTask(VulcanPackage,
                    Resources.Create + name,
                    Resources.Create + name,
                    ParentContainer,
                    connection
                    );

                sqlTask.TransmuteToFileTask(fileName);
                this.FirstExecutableGeneratedByPattern = sqlTask.SQLTaskHost;
                this.LastExecutableGeneratedByPattern = this.FirstExecutableGeneratedByPattern;
            }
        }
Ejemplo n.º 3
0
        public override void Emit(XPathNavigator patternNavigator)
        {
            if (patternNavigator != null)
            {

                string createTableFile = VulcanPackage.AddFileToProject(
                                                Resources.Create + Resources.Schema + Resources.Seperator +
                                                VulcanPackage.Name +
                                                Resources.ExtensionSQLFile
                                            );

                File.Delete(createTableFile);
                string insertSPFile = null;
                string checkAndinsertSPFile = null;
                string insertAndUpdateSPFile = null;
                bool hasCheckAndInsert = false;
                bool hasInsertAndUpdate = false;

                foreach (XPathNavigator nav in patternNavigator.Select("rc:Dimension", VulcanPackage.VulcanConfig.NamespaceManager))
                {
                    string dimensionName = nav.SelectSingleNode("@Name", VulcanPackage.VulcanConfig.NamespaceManager).Value;

                    Message.Trace(Severity.Debug, "Emitting Create Statement for " + dimensionName);

                    TableHelper th = new TableHelper(dimensionName, VulcanPackage.VulcanConfig, nav.SelectSingleNode("rc:Table", VulcanPackage.VulcanConfig.NamespaceManager));
                    TableEmitterEx te = new TableEmitterEx(th, VulcanPackage);
                    te.Emit(createTableFile, true);

                    if (String.IsNullOrEmpty(insertSPFile))
                    {
                        insertSPFile = VulcanPackage.AddFileToProject(
                                                Resources.SPPrefix + Resources.Seperator +
                                                Resources.Insert +
                                                VulcanPackage.Name +
                                                Resources.ExtensionSQLFile
                                                );
                        File.Delete(insertSPFile);
                    }

                    InsertSPEmitter spe = new InsertSPEmitter(dimensionName, nav.SelectSingleNode("rc:Table", VulcanPackage.VulcanConfig.NamespaceManager), th, VulcanPackage);
                    spe.Emit(insertSPFile, true);

                    if (nav.Select("rc:Table/rc:CheckAndInsertUniqueColumn", VulcanPackage.VulcanConfig.NamespaceManager).Count > 0)
                    {
                        hasCheckAndInsert = true;

                        if (String.IsNullOrEmpty(checkAndinsertSPFile))
                        {
                            checkAndinsertSPFile = VulcanPackage.AddFileToProject(
                                                           Resources.SPPrefix + Resources.Seperator +
                                                           Resources.CheckAndInsert +
                                                           VulcanPackage.Name +
                                                           Resources.ExtensionSQLFile
                                                           );

                            File.Delete(checkAndinsertSPFile);
                        }

                        CheckAndInsertSPEmitter cispe = new CheckAndInsertSPEmitter(dimensionName, nav.SelectSingleNode("rc:Table", VulcanPackage.VulcanConfig.NamespaceManager), th, VulcanPackage);
                        cispe.Emit(checkAndinsertSPFile, true);
                    }

                    if (nav.Select("rc:Table/rc:InsertOrUpdateUniqueColumn", VulcanPackage.VulcanConfig.NamespaceManager).Count > 0)
                    {
                        hasInsertAndUpdate = true;

                        if (String.IsNullOrEmpty(insertAndUpdateSPFile))
                        {
                            insertAndUpdateSPFile = VulcanPackage.AddFileToProject(
                                                           Resources.SPPrefix + Resources.Seperator +
                                                           Resources.CheckAndInsert +
                                                           Resources.Update +
                                                           VulcanPackage.Name +
                                                           Resources.ExtensionSQLFile
                                                           );

                            File.Delete(insertAndUpdateSPFile);
                        }
                        InsertAndUpdateSPEmitter iuspe = new InsertAndUpdateSPEmitter(dimensionName, nav.SelectSingleNode("rc:Table", VulcanPackage.VulcanConfig.NamespaceManager), th, VulcanPackage);
                        iuspe.Emit(insertAndUpdateSPFile, true);
                    }
                }

                Dictionary<string, object> properties = new Dictionary<string, object>();
                properties["Name"] = Resources.Create + Resources.Schema + Resources.Seperator + VulcanPackage.Name;

                //TODO: This is a hardcoded bug, should be removed when Dimensions are rewritten!
                Connection dimensionConnection = Connection.GetExistingConnection(VulcanPackage, patternNavigator);

                SQLTask createTableTask =
                    new SQLTask(
                                VulcanPackage,
                                properties["Name"].ToString(),
                                properties["Name"].ToString(),
                                ParentContainer,
                                dimensionConnection,
                                properties
                                );

                createTableTask.TransmuteToFileTask(properties["Name"] + Resources.ExtensionSQLFile);

                properties["Name"] = Resources.SPPrefix + Resources.Seperator +
                                        Resources.Insert +
                                        VulcanPackage.Name;

                this.FirstExecutableGeneratedByPattern = createTableTask.SQLTaskHost;
                this.LastExecutableGeneratedByPattern = this.FirstExecutableGeneratedByPattern;

                SQLTask createInsertSPTask =
                    new SQLTask(
                                VulcanPackage,
                                properties["Name"].ToString(),
                                properties["Name"].ToString(),
                                ParentContainer,
                                dimensionConnection,
                                properties
                                );
                createInsertSPTask.TransmuteToFileTask(properties["Name"] + Resources.ExtensionSQLFile);

                properties["Name"] = Resources.SPPrefix + Resources.Seperator +
                                        Resources.CheckAndInsert +
                                        VulcanPackage.Name;

                properties["Description"] = properties["Name"];

                VulcanPackage.AddPrecedenceConstraint(LastExecutableGeneratedByPattern, createInsertSPTask.SQLTaskHost, ParentContainer);
                this.LastExecutableGeneratedByPattern = createInsertSPTask.SQLTaskHost;

                if (hasCheckAndInsert)
                {
                    SQLTask createCheckInsertSPTask =
                        new SQLTask(
                                    VulcanPackage,
                                    properties["Name"].ToString(),
                                    properties["Name"].ToString(),
                                    ParentContainer,
                                    dimensionConnection,
                                    properties
                                    );
                    createCheckInsertSPTask.TransmuteToFileTask(properties["Name"] + Resources.ExtensionSQLFile);

                    properties["Name"] = Resources.SPPrefix + Resources.Seperator +
                                            Resources.Insert + Resources.Defaults +
                                            VulcanPackage.Name;

                    properties["Description"] = properties["Name"];

                    VulcanPackage.AddPrecedenceConstraint(createInsertSPTask.SQLTaskHost, createCheckInsertSPTask.SQLTaskHost, ParentContainer);
                    this.LastExecutableGeneratedByPattern = createCheckInsertSPTask.SQLTaskHost;
                } // hasCheckAndInsert

                if (hasInsertAndUpdate)
                {
                    properties["Name"] = properties["Name"] = Resources.SPPrefix + Resources.Seperator +
                                            Resources.CheckAndInsert + Resources.Update +
                                            VulcanPackage.Name;
                    properties["Description"] = properties["Name"];

                    SQLTask createInsertUpdateTask =
            new SQLTask(
                VulcanPackage,
                properties["Name"].ToString(),
                properties["Name"].ToString(),
                ParentContainer,
                dimensionConnection,
                properties
                );
                    createInsertUpdateTask.TransmuteToFileTask(properties["Name"] + Resources.ExtensionSQLFile);

                    VulcanPackage.AddPrecedenceConstraint(LastExecutableGeneratedByPattern, createInsertUpdateTask.SQLTaskHost, ParentContainer);
                    this.LastExecutableGeneratedByPattern = createInsertUpdateTask.SQLTaskHost;

                } // hasInsertAndUpdate
            }
        }
Ejemplo n.º 4
0
        public override void Emit(XPathNavigator patternNavigator)
        {
            if (patternNavigator != null)
            {
                string name = patternNavigator.SelectSingleNode("@Name").Value;
                string body = patternNavigator.SelectSingleNode("rc:Body", VulcanPackage.VulcanConfig.NamespaceManager).Value.Trim();
                string type = patternNavigator.SelectSingleNode("@Type").Value;
                string resultSet = patternNavigator.SelectSingleNode("@ResultSet").Value;
                //   Message.Trace("\n\n{0}\n\n", patternNavigator.SelectSingleNode("@Name").);

                Connection c = Connection.GetExistingConnection(VulcanPackage, patternNavigator);

                if (c != null)
                {
                    SQLTask sqlTask = new SQLTask(VulcanPackage,
                       Resources.Create + name,
                       Resources.Create + name,
                        ParentContainer,
                        c
                        );

                    switch (type.ToUpperInvariant())
                    {
                        case "FILE":
                            string fileName = Resources.Create + name + Resources.ExtensionSQLFile;
                            string filePath = VulcanPackage.AddFileToProject(fileName);

                            TemplateEmitter te = new TemplateEmitter(new Template("temp", "temp", body));
                            te.SetParameters("");
                            te.Emit(filePath, false);

                            sqlTask.TransmuteToFileTask(fileName);
                            break;
                        case "EXPRESSION":
                            sqlTask.TransmuteToExpressionTask(body);
                            break;
                        default:
                            break;
                    }

                    switch (resultSet.ToUpperInvariant())
                    {
                        case "NONE":
                            sqlTask.ExecuteSQLTask.ResultSetType = Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ResultSetType.ResultSetType_None;
                            break;
                        case "SINGLEROW":
                            sqlTask.ExecuteSQLTask.ResultSetType = Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ResultSetType.ResultSetType_SingleRow;
                            break;
                        case "FULL":
                            sqlTask.ExecuteSQLTask.ResultSetType = Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ResultSetType.ResultSetType_Rowset;
                            break;
                        case "XML":
                            sqlTask.ExecuteSQLTask.ResultSetType = Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ResultSetType.ResultSetType_XML;
                            break;
                        default:
                            sqlTask.ExecuteSQLTask.ResultSetType = Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ResultSetType.ResultSetType_None;
                            break;
                    }

                    foreach (XPathNavigator resultNavigator in patternNavigator.Select("rc:Result", VulcanPackage.VulcanConfig.NamespaceManager))
                    {
                        sqlTask.BindResult(resultNavigator.SelectSingleNode("@Name").Value, resultNavigator.SelectSingleNode("@VariableName").Value);
                    }
                    this.FirstExecutableGeneratedByPattern = sqlTask.SQLTaskHost;
                    this.LastExecutableGeneratedByPattern = this.FirstExecutableGeneratedByPattern;

                    this.ExecuteDuringDesignTime(patternNavigator,sqlTask.SQLTaskHost);
                } // if c != null
                else
                {
                    Message.Trace(Severity.Error, "{0}: Connection {1} does not exist.", name, patternNavigator.SelectSingleNode("rc:Connection", VulcanPackage.VulcanConfig.NamespaceManager).OuterXml);
                }
            }
        }
Ejemplo n.º 5
0
        public override void Emit(XPathNavigator patternNavigator)
        {
            if (patternNavigator != null)
            {
                string firstOrLast = patternNavigator.SelectSingleNode("@FirstOrLast").Value;
                string status = patternNavigator.SelectSingleNode("@Status").Value;
                string notes = patternNavigator.SelectSingleNode("@Notes").Value;

                Connection tableConnection =
                    Connection.GetExistingConnection(VulcanPackage, LogtainerPattern.CurrentLog.TableConnectionName);

                string execSqlTaskName = LogtainerPattern.CurrentLog.LogName + Resources.Seperator + firstOrLast + Guid.NewGuid();
                TemplateEmitter te = new TemplateEmitter(VulcanPackage.TemplateManager["LogSelectQuery"]);
                if (
                    LogtainerPattern.CurrentLog.SourceColumn == null ||
                    LogtainerPattern.CurrentLog.DestinationColumn == null ||
                    LogtainerPattern.CurrentLog.TableConnectionName == null ||
                    LogtainerPattern.CurrentLog.Table == null)
                {
                    Message.Trace(Severity.Error,
                        "Could not perform LogUpdate (On Log: {0}), Parent Logtainer does not contain all of the necessary information.  Needs SourceColumn, DestinationColumn, TableConnectionName, and Table attributes.",LogtainerPattern.CurrentLog.LogName);
                    return;
                }

                te.SetNamedParameter("Source", LogtainerPattern.CurrentLog.SourceColumn);
                te.SetNamedParameter("Destination", LogtainerPattern.CurrentLog.DestinationColumn);
                te.SetNamedParameter("Table", LogtainerPattern.CurrentLog.Table);
                te.SetNamedParameter("Status", status);
                te.SetNamedParameter("Notes", notes);
                te.SetNamedParameter("SourceConvertStyle", "21");
                te.SetNamedParameter("DestinationConvertStyle", "21");

                string query;
                te.Emit(out query);

                SQLTask readForLogTask = new SQLTask(VulcanPackage, execSqlTaskName, execSqlTaskName, ParentContainer, tableConnection);
                readForLogTask.TransmuteToExpressionTask(String.Format("\"{0}\"", query));
                readForLogTask.ExecuteSQLTask.ResultSetType = Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ResultSetType.ResultSetType_SingleRow;

                DTS.Variable sourceVar = LogtainerPattern.CurrentLog[firstOrLast+"SourceRecord"];
                DTS.Variable destVar = LogtainerPattern.CurrentLog[firstOrLast+"DestinationRecord"];
                DTS.Variable statusVar = LogtainerPattern.CurrentLog["Status"];
                DTS.Variable notesVar = LogtainerPattern.CurrentLog["Notes"];

                readForLogTask.BindResult("0", sourceVar.QualifiedName);
                readForLogTask.BindResult("1", destVar.QualifiedName);
                readForLogTask.BindResult("2", statusVar.QualifiedName);
                readForLogTask.BindResult("3", notesVar.QualifiedName);

                this.FirstExecutableGeneratedByPattern = readForLogTask.SQLTaskHost;
                this.LastExecutableGeneratedByPattern = this.FirstExecutableGeneratedByPattern;
            }
        }
Ejemplo n.º 6
0
        public override void Emit(XPathNavigator patternNavigator)
        {
            if (patternNavigator != null)
            {
                string name = patternNavigator.SelectSingleNode("@Name").Value;
                string body = patternNavigator.SelectSingleNode("rc:Body", VulcanPackage.VulcanConfig.NamespaceManager).Value;

                string fileName =
                   Resources.Create +
                    name +
                    Resources.ExtensionSQLFile;

                string filePath = VulcanPackage.AddFileToProject(fileName);

                StoredProcEmitter spe = new StoredProcEmitter(name, body, VulcanPackage);
                foreach (XPathNavigator columnNav in patternNavigator.Select("rc:Columns/rc:Column", VulcanPackage.VulcanConfig.NamespaceManager))
                {
                    bool isOutput = columnNav.SelectSingleNode("@IsOutput").ValueAsBoolean;

                    spe.AddColumn(
                        columnNav.SelectSingleNode("@Name").Value,
                        columnNav.SelectSingleNode("@Default").Value,
                        columnNav.SelectSingleNode("@Type").Value,
                        isOutput);
                }
                spe.Emit(filePath, false);

                Connection c = Connection.GetExistingConnection(VulcanPackage, patternNavigator);
                SQLTask sqlTask = new SQLTask(VulcanPackage,
                   Resources.Create + name,
                   Resources.Create + name,
                    ParentContainer,
                    c
                    );

                sqlTask.TransmuteToFileTask(fileName);

                this.ExecuteDuringDesignTime(patternNavigator, sqlTask.SQLTaskHost);

                this.FirstExecutableGeneratedByPattern = sqlTask.SQLTaskHost;
                this.LastExecutableGeneratedByPattern = this.FirstExecutableGeneratedByPattern;
            }
        }
Ejemplo n.º 7
0
        public override void Emit(XPathNavigator patternNavigator)
        {
            if (patternNavigator != null)
            {
                string taskName = patternNavigator.SelectSingleNode("@Name").Value;
                string connectionName = patternNavigator.SelectSingleNode("@Connection").Value;
                string varPrefix = patternNavigator.SelectSingleNode("@PreviousLogEntryVariablePrefix").Value;

                string sourceColumn = patternNavigator.SelectSingleNode("@SourceColumn") == null ? null : patternNavigator.SelectSingleNode("@SourceColumn").Value;
                string destinationColumn = patternNavigator.SelectSingleNode("@DestinationColumn") == null ? null : patternNavigator.SelectSingleNode("@DestinationColumn").Value;
                string table = patternNavigator.SelectSingleNode("@Table")== null ? null : patternNavigator.SelectSingleNode("@Table").Value;
                string tableConnectionName = patternNavigator.SelectSingleNode("@TableConnection") == null ? null : patternNavigator.SelectSingleNode("@TableConnection").Value;

                if (varPrefix.ToUpperInvariant() == "varLog")
                {
                    Message.Trace(Severity.Error, "Name: {0}: Error in PreviousLogEntryVariablePrefix: varLog is a reserved variable name.", taskName);
                    return;
                }

                Connection connection =
                    Connection.GetExistingConnection(VulcanPackage, connectionName);

                LogtainerLog ll = new LogtainerLog(
                                                    VulcanPackage,
                                                    Resources.LogVariablePrefix + VulcanPackage.Name + taskName,
                                                    sourceColumn,
                                                    destinationColumn,
                                                    table,
                                                    tableConnectionName
                                                    );

                string execSqlTaskName = Resources.Log + Resources.Seperator + VulcanPackage.Name + Resources.Seperator + taskName + Resources.Seperator;
                SQLTask logStartTask = new SQLTask(VulcanPackage, execSqlTaskName + Resources.Start, execSqlTaskName + Resources.Start, ParentContainer, connection);

                TemplateEmitter te = new TemplateEmitter(VulcanPackage.TemplateManager["LogStart"]);
                te.SetNamedParameter("ETLName", VulcanPackage.Name);
                te.SetNamedParameter("TaskName", taskName);

                if (_logStack.Count > 0)
                {
                    te.SetNamedParameter("ParentLogID", "?");
                    // Yes you have to hard code the data type as there is no lookup or cross-reference source, and the intger is dependent on the connection you create... bugbug!
                    logStartTask.BindParameter(CurrentLog.LogVariable, Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ParameterDirections.Input, 3);
                }
                else
                {
                    te.SetNamedParameter("ParentLogID", "NULL");
                }
                logStartTask.BindParameter(ll.LogVariable, Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ParameterDirections.Output, 3);
                logStartTask.BindParameter(ll.LastRecordLogVariable, Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ParameterDirections.Output, 3);
                logStartTask.BindParameter(ll.IsAnotherInstanceCurrentlyRunningLogVariable, Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ParameterDirections.Output, 3);

                string sqlExpression;
                te.Emit(out sqlExpression);
                logStartTask.TransmuteToExpressionTask(sqlExpression);

                te = new TemplateEmitter(VulcanPackage.TemplateManager["LogGetValue"]);
                te.SetNamedParameter("LogID", ll.LastRecordLogVariable.QualifiedName);
                this.FirstExecutableGeneratedByPattern = logStartTask.SQLTaskHost;

                // Push the current log variable onto the stack!
                _logStack.Push(ll);

                //Add a new SQL Task to read the  previous log
                te = new TemplateEmitter("LogGetValue", VulcanPackage, ll.LastRecordLogVariable.QualifiedName);
                string readPreviousLogValuesQuery;
                te.Emit(out readPreviousLogValuesQuery);

                SQLTask readPreviousLogValues = new SQLTask(VulcanPackage, Resources.Log + Resources.LoadInto + varPrefix, Resources.Log + Resources.LoadInto + varPrefix, ParentContainer,connection);
                readPreviousLogValues.TransmuteToExpressionTask(readPreviousLogValuesQuery);
                VulcanPackage.AddPrecedenceConstraint(this.FirstExecutableGeneratedByPattern, readPreviousLogValues.SQLTaskHost, ParentContainer);

                //Bind and create variables for the SQL Task that reads the previous log. This is kinda hacky
                readPreviousLogValues.BindParameter(
                    VulcanPackage.AddVariable(varPrefix + "StartTime", new DateTime(1980,1,1)),
                    Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ParameterDirections.Output,
                    (int)System.Data.OleDb.OleDbType.DBTimeStamp,
                    255);
                readPreviousLogValues.BindParameter(
                    VulcanPackage.AddVariable(varPrefix + "EndTime", new DateTime(1980,1,1)),
                    Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ParameterDirections.Output,
                    (int)System.Data.OleDb.OleDbType.DBTimeStamp,
                    255);

                readPreviousLogValues.BindParameter(
                    VulcanPackage.AddVariable(varPrefix + "FirstSourceRecord", String.Empty),
                    Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ParameterDirections.Output,
                    (int)System.Data.OleDb.OleDbType.WChar,
                    255);
                readPreviousLogValues.BindParameter(
                    VulcanPackage.AddVariable(varPrefix + "FirstDestinationRecord", String.Empty),
                    Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ParameterDirections.Output,
                    (int)System.Data.OleDb.OleDbType.WChar,
                    255);
                readPreviousLogValues.BindParameter(
                    VulcanPackage.AddVariable(varPrefix + "LastSourceRecord", String.Empty),
                    Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ParameterDirections.Output,
                    (int)System.Data.OleDb.OleDbType.WChar,
                    255);
                readPreviousLogValues.BindParameter(
                    VulcanPackage.AddVariable(varPrefix + "LastDestinationRecord", String.Empty),
                    Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ParameterDirections.Output,
                    (int)System.Data.OleDb.OleDbType.WChar,
                    255);

                readPreviousLogValues.BindParameter(
                    VulcanPackage.AddVariable(varPrefix + "Status", String.Empty),
                    Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ParameterDirections.Output,
                    (int)System.Data.OleDb.OleDbType.WChar,
                    255);

                readPreviousLogValues.BindParameter(
                    VulcanPackage.AddVariable(varPrefix + "Notes", String.Empty),
                    Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ParameterDirections.Output,
                    (int)System.Data.OleDb.OleDbType.WChar,
                    255);

                // Handle the sub-tasks just like the Container pattern
                DTS.Executable previousExec = readPreviousLogValues.SQLTaskHost;
                Pattern p = null;
                foreach (XPathNavigator nav in patternNavigator.SelectChildren(XPathNodeType.Element))
                {
                    p = PatternFactory.ProcessPattern(VulcanPackage, ParentContainer, nav, p);
                    VulcanPackage.AddPrecedenceConstraint(previousExec, p.FirstExecutableGeneratedByPattern, ParentContainer);
                    previousExec = p.LastExecutableGeneratedByPattern;
                }

                this.LastExecutableGeneratedByPattern = previousExec;

                // Pop the current log variable off of the stack and end the log.
                ll = _logStack.Pop();

                te = new TemplateEmitter(VulcanPackage.TemplateManager["LogSetValue"]);
                te.SetNamedParameter("LogID", ll.LogVariable.QualifiedName);
                StringBuilder writeValuesToLogQuery = new StringBuilder();
                foreach (string column in ll.LogColumnDictionary.Keys)
                {
                    string temp;
                    te.SetNamedParameter("Column", column);
                    te.SetNamedParameter("Value", ll.LogColumnDictionary[column].QualifiedName);
                    te.Emit(out temp);
                    writeValuesToLogQuery.Append(temp);
                    writeValuesToLogQuery.AppendFormat(" + \n");
                }

                te = new TemplateEmitter(VulcanPackage.TemplateManager["LogEnd"]);
                te.Emit(out sqlExpression);

                writeValuesToLogQuery.Append(sqlExpression);

                SQLTask logEndTask = new SQLTask(VulcanPackage, execSqlTaskName + Resources.Stop, execSqlTaskName + Resources.Stop, ParentContainer, connection);
                logEndTask.TransmuteToExpressionTask(writeValuesToLogQuery.ToString());
                logEndTask.BindParameter(ll.LogVariable, Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ParameterDirections.Input, 3);
                if (previousExec != null)
                {
                    VulcanPackage.AddPrecedenceConstraint(previousExec, logEndTask.SQLTaskHost, ParentContainer);
                }
                this.LastExecutableGeneratedByPattern = logEndTask.SQLTaskHost;
            }
        }