Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
 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();
 }
Example #4
0
        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;
            }
        }