Example #1
0
        private static void SetupScript(IJob job, XElement definition, IScope context)
        {
            var info = GetTaskInfo(job, definition);

            if (!info.Proceed)
            {
                return;
            }
            ITask task;

            if (!string.IsNullOrWhiteSpace(definition.Value))
            {
                task = new ScriptTextDbUpdateTask(info.Key, definition.Value, definition.Attr("hash"))
                {
                    Job = job, Idx = info.Idx
                };
            }
            else
            {
                task = new ScriptFileDbUpdateTask(info.Name, info.Key + ".")
                {
                    Job = job, Idx = info.Idx
                };
            }
            job.Tasks[info.Key] = task;
        }
Example #2
0
 public void WillExectuteUpdatedScriptTwice()
 {
     var t = new ScriptTextDbUpdateTask("a", "select 1 print '1 selected'") { Database = DbName };
     t.Execute();
     t = new ScriptTextDbUpdateTask("a", "select 1 print '1 selected' --rem") { Database = DbName };
     t.Execute();
     Assert.AreEqual(TaskState.Success, t.State);
 }
Example #3
0
 public void CanExecuteTextScript() {
     var t = new ScriptTextDbUpdateTask("a", "select 1 print '1 selected'") { Database = DbName };
     t.Execute();
     if (null != t.Error)
     {
         Console.WriteLine(t.Error);
     }
     Assert.AreEqual(TaskState.Success, t.State);
 }