private void Complete() { if (_connection != null) { _connection.Transaction = null; } _connection = null; _completed = true; }
internal TaosTransaction(TaosConnection connection, IsolationLevel isolationLevel) { _connection = connection; _isolationLevel = isolationLevel; //connection.ExecuteNonQuery( // IsolationLevel == IsolationLevel.Serializable // ? "BEGIN IMMEDIATE;" // : "BEGIN;"); }
public async void Connect(TaosConnectionStringBuilder connectionString) { lblCursor.Text = Resources.Opening + connectionString.DataSource; lblElapsed.Text = Resources.Reading; prgRunning.Style = ProgressBarStyle.Marquee; btnConnect.Enabled = false; try { _db = await this.AsyncConnect(connectionString); // force open database var uv = _db.ServerVersion; } catch (Exception ex) { _db?.Dispose(); _db = null; MessageBox.Show(ex.Message, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } finally { lblCursor.Text = ""; lblElapsed.Text = ""; prgRunning.Style = ProgressBarStyle.Blocks; btnConnect.Enabled = true; } btnConnect.Enabled = true; lblCursor.Text = ""; prgRunning.Style = ProgressBarStyle.Blocks; _connectionString = connectionString; _codeCompletion.UpdateCodeCompletion(_db); btnConnect.Text = Resources.Disconnect; this.UIState(true); tabSql.TabPages.Add("+", "+"); this.LoadTreeView(); this.AddNewTab("(none)", ""); txtSql.Focus(); }
private void Disconnect() { foreach (var tab in tabSql.TabPages.Cast <TabPage>().Where(x => x.Name != "+").ToArray()) { var task = tab.Tag as TaskData; task.ThreadRunning = false; task.WaitHandle.Set(); } // clear all tabs and controls tabSql.TabPages.Clear(); txtSql.Clear(); grdResult.Clear(); txtResult.Clear(); tvwDatabase.Nodes.Clear(); btnConnect.Text = Resources.Connect; this.UIState(false); tvwDatabase.Focus(); tlbMain.Enabled = false; lblCursor.Text = Resources.Closing; try { _db?.Dispose(); _db = null; lblCursor.Text = ""; tlbMain.Enabled = true; } catch (Exception ex) { MessageBox.Show(ex.Message, Resources._ERROR, MessageBoxButtons.OK, MessageBoxIcon.Stop); } }