Ejemplo n.º 1
0
        public void BuildProcedureCode(DatabaseSchema databaseSchema, DatabaseStoredProcedure databaseStoredProcedure)
        {
            try
            {
                //grab the data
                if (databaseStoredProcedure.ResultSets.Count == 0)
                {
                    //Delete sprocs won't have resultsets, so will get called multiple times
                    var sprocRunner = new DatabaseSchemaReader.Procedures.ResultSetReader(databaseSchema);
                    sprocRunner.ExecuteProcedure(databaseStoredProcedure);
                }

                //write it
                var sprocWriter = new ProcedureWriter(databaseStoredProcedure, "Domain");
                var txt         = sprocWriter.Write();

                Clipboard.SetText(txt, TextDataFormat.UnicodeText);
            }
            catch (Exception exception)
            {
                Clipboard.SetText("//sorry, not available - " + exception.Message,
                                  TextDataFormat.UnicodeText);
                Debug.WriteLine(exception.Message);
            }
        }
Ejemplo n.º 2
0
        public string BuildProcedureCode(DatabaseSchema databaseSchema, DatabaseStoredProcedure databaseStoredProcedure)
        {
            StringBuilder sb = new StringBuilder();

            try
            {
                if (databaseStoredProcedure.ResultSets.Count == 0)
                {
                    var sprocRunner = new Nikita.Base.DbSchemaReader.Procedures.ResultSetReader(databaseSchema);
                    sprocRunner.ExecuteProcedure(databaseStoredProcedure);
                }

                var sprocWriter = new ProcedureWriter(databaseStoredProcedure, "Domain");
                sb.Append(sprocWriter.Write());
            }
            catch (Exception exception)
            {
                Debug.WriteLine(exception.Message);
            }
            return(sb.ToString());
        }