object Progress(CommandRun cmdAcs, string sqlText, params object[] paramers) { return(Command(cmd => { cmd.Parameters.Clear(); this.script = Script.Create(sqlText, paramers); switch (paramers.Length) { case 1: if (paramers[0] is System.Collections.IDictionary) { cmd.CommandText = SqlParamer.Format(this.dbProvider, this.isAutoPfx, cmd, sqlText, (System.Collections.IDictionary)paramers[0]); } else { goto default; } break; default: cmd.CommandText = SqlParamer.Format(this.dbProvider, this.isAutoPfx, cmd, sqlText, paramers); break; } return cmdAcs(cmd); })); }
int[] ISqler.ExecuteNonQuery(IDictionary paramKeys, params string[] sqlTexts) { var list = new List <int>(); this.Command(cmd => { for (var i = 0; i < sqlTexts.Length; i++) { var sqlText = sqlTexts[i]; try { cmd.Parameters.Clear(); cmd.CommandText = SqlParamer.Format(this.dbProvider, this.isAutoPfx, cmd, sqlText, paramKeys); list.Add(cmd.ExecuteNonQuery()); } catch { list.Add(-1); } } return(0); }); return(list.ToArray()); }
void ISqler.Execute(System.Predicate <Script> predicate, System.Action <DbCommand> action) { this.Command(cmd => { this.script = Script.Create(String.Empty, new object[0]); while (predicate(this.script)) { if (String.IsNullOrEmpty(this.script.Text)) { break; } else { cmd.Parameters.Clear(); cmd.CommandText = SqlParamer.Format(this.dbProvider, this.isAutoPfx, cmd, this.script.Text, this.script.Arguments); action(cmd); this.script.Reset(String.Empty); } } return(0); }); }