Subject Re: [IBO] How do I post multiple datasets in a single transaction?
Author masonwheeler
--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@...> wrote:
>
> >And if that's what you mean, I can't set up the transaction first because there are multiple different editing operations which might require saving different groups of datasets together. Besides, if I did that, it would still require assigning a transaction to the dataset
>
> That's not the way things work at all. See my previous message.
> You can have multiple transactions per connection and multiple statements per transaction. What you can't have is statements hopping about between different transactions.
>
> Do you understand transaction isolation at all?

Of course. Do you understand the concept of local, in-memory data (a dataset) at all? Because you seem to be conflating it rather seriously with the concept of updates being applied to the database.

> Statements (specifically, SELECT statements) return result sets, which you are referring to as datasets.

No, I am referring to the TDataset descendant object (TIBOTable) that holds the local data from the result set in memory as a dataset.

> By default, transactions are read-write. As soon as you "post" the outcome of an edit (UPDATE), append (INSERT) or delete operation on the client side, the record concerned becomes locked to other transactions until your transaction is committed.

So let me get this straight. Are you telling me that all client-side edits get immediately transmitted to the database, without waiting for me to call ApplyUpdates? What's the point of having an ApplyUpdates method, then? This just keeps getting crazier!

>How it is seen by other transactions after your transaction commits depends on the isolation level of those other transactions.

What are you talking about? It should not be seen by *any* transactions until I actually start to send changes back to the database.

> >, and having to close and reopen the datasets every time I change transactions is insane.
>
> Why do you think it is insane?

Why do you think it isn't? Having to pull all that data that's already in memory *back* from the database into local memory again, just because I want to start a new transaction? What's *not* insane about that? What if I had a million rows in the table?

> Do a bit of reading up about transactions? There are quite a few papers on the subject at http://www.ibobjects.com/TechInfo.html. Also check out the IBO help on the various data-access classes.

I'm quite familiar with the concept of transactions. What I'm trying to understand is how to decouple them from *local edits*.