private void Execute(ExecutionPlan plan, StringBuilder query, IDbTransaction transaction, IDbCommand cmd, ref bool cancel) { if (query.Length <= 0) { return; } //We start a new batch cmd.CommandText = query.ToString(); cmd.Transaction = transaction; //Exec query using (var dr = cmd.ExecuteReader()) RetriveAutoGeneratedPk(plan, dr); if (QueryCommmiting != null) { var args = new QueryCommitingEventArgs(cmd); QueryCommmiting(null, args); if (args.Cancel) { cancel = true; } } }
private void ClonerWorkerQueryCommiting_event(object sender, QueryCommitingEventArgs e) { //On doit savoir dans le thread 2 la valeur du thread 1 //car ReportProgress call le thread 1 en asyn. System.Windows.Application.Current.Dispatcher.Invoke( DispatcherPriority.Normal, (ThreadStart) delegate { e.Cancel = chkSimulation.IsChecked.GetValueOrDefault(); }); _cloneWorker.ReportProgress(0, e); }
/// <summary> /// When the query is ready to be executed /// </summary> private static void Query_Commiting(object sender, QueryCommitingEventArgs e) { //Don't commit the Sql query e.Cancel = true; Console.WriteLine(); Console.WriteLine("Generated query : "); Console.BackgroundColor = ConsoleColor.DarkYellow; Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(e.Command.GetGeneratedQuery()); Console.ResetColor(); }
public void QueryCommiting_event(object sender, QueryCommitingEventArgs e) { scintilla.IsReadOnly = false; scintilla.Text += e.Command.GetGeneratedQuery(); scintilla.IsReadOnly = true; }