Example #1
0
 internal static void Commit(DbConnection con)
 {
     using (var command = new DbCommandFactory(con, "commit").Create())
     {
         command.ExecuteNonQuery();
     }
 }
Example #2
0
 internal static void SetAutoCommit(DbConnection con, bool autoCommit)
 {
     using (var command = new DbCommandFactory(con, "set autocommit=" + (autoCommit == true ? "1" : "0")).Create())
     {
         command.ExecuteNonQuery();
     }
 }
Example #3
0
 private void loadAndExecute(object sender, DoWorkEventArgs e)
 {
     try
     {
         if (core.db.DB.IsConnectedToDatabase(con))
         {
             List<string> list = core.sql.Utils.convert(Firedump.core.sql.Utils.GetDbTypeEnum(con), File.ReadAllText(file));
             Invoke((MethodInvoker)delegate ()
             {
                 progressBar1.Maximum = list.Count;
                 progressBar1.Step = 1;
                 progressBar1.Value = 0;
                 labelStatus.Text = "Running";
             });
             foreach (string q in list)
             {
                 if (worker.CancellationPending == true)
                 {
                     e.Cancel = true;
                     return;
                 }
                 using (var Command = new DbCommandFactory(con, q).Create())
                 {
                     int res = Command.ExecuteNonQuery();
                 }
                 Invoke((MethodInvoker)delegate ()
                 {
                     progressBar1.PerformStep();
                 });
             }
         }
     }
     finally
     {
         Invoke((MethodInvoker)delegate ()
         {
             progressBar1.Enabled = false;
             progressBar1.Visible = false;
             labelStatus.Text = "Completed";
         });
     }
 }