Esempio n. 1
0
        public string GenerateScript(IDatabaseFactory factory, IShellContext context, bool useTransaction, List<ParameterModel> pars, Dictionary<string, string> parValues)
        {
            var cmp = new SqlScriptCompiler(factory, this, context, null);

            cmp.PutScriptProlog(useTransaction, pars, parValues);
            DumpScript(cmp, useTransaction);

            return cmp.GetCompiledSql();
        }
Esempio n. 2
0
 private string GenerateCreateProcedureCore(IDatabaseFactory factory, NameWithSchema name, IShellContext context, bool useTransaction, string createKeyword, List<ParameterModel> pars, string editorInfo)
 {
     var cmp = new SqlScriptCompiler(factory, this, context, name.ToString());
     cmp.PutProcedureHeader(name, useTransaction, createKeyword, pars);
     DumpScript(cmp, useTransaction);
     cmp.PutProcedureFooter();
     cmp.PutEditorInfo(editorInfo);
     return cmp.GetCompiledSql();
 }
Esempio n. 3
0
 public string GenerateCreateProcedure(IDatabaseFactory factory, NameWithSchema name, IShellContext context, bool useTransaction, bool overwriteExisting, List<ParameterModel> pars, string editorInfo)
 {
     if (overwriteExisting)
     {
         string sqlCore = GenerateCreateProcedureCore(factory, name, context, useTransaction, "", pars, editorInfo);
         var cmp = new SqlScriptCompiler(factory, this, context, name.ToString());
         cmp.CreateOrAlterProcedure(name, sqlCore);
         return cmp.GetCompiledSql();
     }
     else
     {
         return GenerateCreateProcedureCore(factory, name, context, useTransaction, "create", pars, editorInfo);
     }
 }
Esempio n. 4
0
 public void Run(DbConnection conn, IDatabaseFactory factory, IShellContext context, bool useTransaction, List<ParameterModel> pars, Dictionary<string, string> parValues)
 {
     FillExternalSources(conn, factory, context);
     var cmp = new SqlScriptCompiler(factory, this, context, null);
     cmp.PutScriptProlog(useTransaction, pars, parValues);
     DumpScript(cmp, useTransaction);
     ExecuteScript(conn, cmp.GetCompiledSql());
     FreeExternalSources(conn, factory, context);
 }