public static PhysicalTask.SqlTask Lower(this AstTask.AstStoredProcNode astNode) { if (astNode.AsClassOnly) { return null; } try { PhysicalTSQL.StoredProc physicalStoredProc = new Ssis2008Emitter.IR.TSQL.StoredProc(); physicalStoredProc.Body = astNode.Body; physicalStoredProc.ExecuteDuringDesignTime = astNode.ExecuteDuringDesignTime; physicalStoredProc.Name = astNode.Name; physicalStoredProc.Columns.Parent = physicalStoredProc; foreach (AstTask.AstStoredProcColumnNode column in astNode.Columns) { PhysicalTSQL.StoredProcColumn physicalColumn = new Ssis2008Emitter.IR.TSQL.StoredProcColumn(); physicalColumn.Default = column.Default; physicalColumn.IsOutput = column.IsOutput; physicalColumn.Name = column.Name; physicalColumn.Parent = physicalStoredProc; physicalColumn.Type = Ssis2008Emitter.Emitters.TSQL.PhysicalTypeTranslator.Translate(column.Type, column.Length, column.Precision, column.Scale, column.CustomType); physicalStoredProc.Columns.ColumnList.Add(physicalColumn); } TSQLEmitter.StoredProcPlatformEmitter storedProcEmitter = new TSQLEmitter.StoredProcPlatformEmitter(); string storedProcBody = storedProcEmitter.Emit(physicalStoredProc); PhysicalTask.SqlTask sqlTask = new Ssis2008Emitter.IR.Task.SqlTask(); sqlTask.Body = storedProcBody; AddConnection(astNode.Connection); sqlTask.Connection = astNode.Connection.Name; sqlTask.ExecuteDuringDesignTime = astNode.ExecuteDuringDesignTime; sqlTask.Name = astNode.Name; sqlTask.ResultSet = "None"; sqlTask.Type = "File"; return sqlTask; } catch (Exception e) { throw new SSISEmitterException(astNode, e); } }
private void Append(StoredProcColumn column) { string output = column.IsOutput ? "OUTPUT" : ""; string defaultValue = string.IsNullOrEmpty(column.Default) ? string.Empty : " = " + column.Default; _stringBuilder.AppendFormat(System.Globalization.CultureInfo.InvariantCulture, "@{0} {1} {2} {3}", column.Name, column.Type, defaultValue, output); }