Board index » delphi » editing records

editing records


2007-09-17 02:45:07 PM
delphi0
hi,
how to get the old and new field values before or after posting
info. into db. using tibdataset, i mean, if user update 3
records(editing a dbgrid) from amount_field or x_field, it's
possible to know what records he changed?, the new and old
values from the changed recorords?.
How tibdataset store those values, where tibdataset keep the
values to save it or discard it depending if it will be commited
or rolledback?
REgards
 
 

Re:editing records

Transaction control, which includes committing and rolling back
transactions, is built into the database server, InterBase in your
case. It has nothing to do with the data access components. When you
change a record using TIBDataSet the changes are sent to the IB server
when you post the record. TIBDataSet does not store the old and new
values. If you want to buffer the changes locally use TClientDataSet
and TDataSetProvider with your TIBDataSet.
--
Bill Todd (TeamB)
 

Re:editing records

"Bill Todd" <XXXX@XXXXX.COM>writes:
Quote
Transaction control, which includes committing and rolling back
transactions, is built into the database server, InterBase in your
case. It has nothing to do with the data access components. When you
change a record using TIBDataSet the changes are sent to the IB server
when you post the record. TIBDataSet does not store the old and new
values. If you want to buffer the changes locally use TClientDataSet
and TDataSetProvider with your TIBDataSet.

--
Bill Todd (TeamB)
ok, so tibdataset doesn't keep anything in memory just direct
to ib, so when you roll back posting, ib transaction rollaback
all prior record posted on the table or tables.
Something else, about transaction, in my app. i have two trans.
one for reading(read commited) and another one for
writing(write consistency), i mean, components which opens
select statements, has the read transaction, and components
which execute insert, update, delte, has write transaction set
it. so for a tibdataset which supports all kind of sql
statements(select, insert, etc), which must be the most
appropriated transaction for it?.
Does my approach right(those two transaction)?
Which the best transaction control(snapshot, read commited,
write cons, etc) to set ibcomponents
Regards
 

Re:editing records

jorge novoa writes:
Quote
ok, so tibdataset doesn't keep anything in memory just direct
to ib, so when you roll back posting, ib transaction rollaback
all prior record posted on the table or tables.
That is correct.
Quote

Something else, about transaction, in my app. i have two trans.
one for reading(read commited) and another one for
writing(write consistency), i mean, components which opens
That does not make sense. If other users are doing updates and deletes
and you need to have a transaction used for reading that will be active
for a long time then you should use a read committed read only
transaction so the transaction will not inhibit garbage collection.
Snapshot (consistency) isolation only makes sense when you are reading
data. If the write transaction will only be used for insert, update and
delete statements then it should use read committed transaction
isolation.
Quote
select statements, has the read transaction, and components
which execute insert, update, delte, has write transaction set
it. so for a tibdataset which supports all kind of sql
statements(select, insert, etc), which must be the most
appropriated transaction for it?.
Either a read write transaction using read committed isolation or a
read write transaction using snapshot isolation. Whether read committed
or snapshot is better depends on whether you will read data more than
once and whether you want to see changes made by other users during the
life of your transaction.
Quote

Does my approach right(those two transaction)?
Which the best transaction control(snapshot, read commited,
write cons, etc) to set ibcomponents
There is no right or wrong way to use transactions. You need to
understand how the different isolation levels work and use the
isolation level that makes sense in the context of what your
application is doing in that transaction.
--
Bill Todd (TeamB)
 

Re:editing records

jorge novoa writes:
Quote
hi,
how to get the old and new field values before or after posting
info. into db. using tibdataset, i mean, if user update 3
records(editing a dbgrid) from amount_field or x_field, it's
possible to know what records he changed?, the new and old
values from the changed recorords?.
You can get at this is you use CachedUpdates. The OldValue and NewValue
properties of TField will return the old values. After calling ApplyUpdates you
no longer can access the old values.
Quote
How tibdataset store those values, where tibdataset keep the
values to save it or discard it depending if it will be commited
or rolledback?

REgards
--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
And so I patrol in the valley of the shadow of the tricolor
I must fear evil. For I am but mortal and mortals can only die.
Asking questions, pleading answers from the nameless
faceless watchers that stalk the carpeted corridors of Whitehall.
(Fish)