public int InsertAllRows(DsnConnection NewConnection, int LocationId) { int InsertCount = 0; connection = NewConnection; switch (connection.DbMode) { case DsnConnection.ConnectionMode.Sqlite: connection.BeginTransaction(); break; } foreach (DataRow row in Rows) { if (DoInsertRow(row, LocationId)) { InsertCount++; } } switch (connection.DbMode) { case DsnConnection.ConnectionMode.Sqlite: connection.EndTransaction(); break; } return(InsertCount); }
public int DeleteAllRows(DsnConnection NewConnection) { int DeleteCount = 0; connection = NewConnection; switch (connection.DbMode) { case DsnConnection.ConnectionMode.Sqlite: connection.BeginTransaction(); break; } foreach (DataRow row in Rows) { if (DoDeleteRow(row)) { DeleteCount++; } } switch (connection.DbMode) { case DsnConnection.ConnectionMode.Sqlite: connection.EndTransaction( );; break; } return(DeleteCount); }
public void Commit(DsnConnection odbc) { odbc.BeginTransaction(); foreach (DataTable m in PersistantTables) { Log.log("Commiting " + m.ToString()); DsnSQLUtil.CommitChanges(odbc, m); } odbc.EndTransaction(); active_dataset.AcceptChanges(); }
void DelayCommit(object sender, EventArgs e) { if (DateTime.Now > target_tick) { if (pending_dsn == null) { return; } pending_dsn.BeginTransaction(); Log.log("tick delay"); foreach (DataTable table in commit_pending) { DsnSQLUtil.CommitChanges(pending_dsn, table); } pending_dsn.EndTransaction(); commit_pending.Clear(); delay_commit.Stop(); delay_commit.Dispose(); delay_commit = null; } }