How to deal with transactions?
Ruslan Zasukhin
sunshine at public.kherson.ua
Fri Jan 19 14:27:11 CST 2007
On 19/1/07 9:53 PM, "hmeier at gmx.net" <hmeier at gmx.net> wrote:
Hi Hans,
> I'm currently trying to rebuild an app. It's a multi-user app attached to a
> SQL database. It used to be all SQL-statements for insert, update, lock
> record, begin transaction, ...
> Now I try to do it all with Valentina DB (server), using the classes provided
> in an object-orientated manner.
> So far I could use the examples provided to do all the "general stuff" like
> adding, deleting, updating records.
Well, I can note that for CLIENT/SERVER the SQL is better way.
We have put a lots of efforts to make working also API way and Class way
with VSERVER, but please read this warning:
* we believe that SQL is the most safe way for use with
client/server model
* you can use API/Class way but only if you will use Vserver on local
fast network or even on local-host as middle-ware.
We going yet learn self and improve Class way, to be used with client/server
model.
> But now I come to a point where I don't know how to do it. I'd like to do some
> changes on several records in several tables. During this process I need to
> protect some records (lock them for writing for other users connected to the
> db) and unlock them again at the end of this very process (in which I may have
> updated the locked record - and others, of course).
> I used to do this with SQL transactions. But how to do it all with Valentina?
> Can anyone please give me some hints to get started or even some code sample?
Use for this Vcursor.
curs1 = db.SqlSelect( query T1, kReadWrite )
curs2 = db.SqlSelect( query T2, kReadWrite )
And
curs1.AddRecord()
curs2.UpdateRecord()
....
db.Flush() // ala-commit
curs2 = nil // unlock
curs1 = nil // unlock
Please note, that Valentina v2 do not have true transactions, with
commit/rollback. This is planed for v3.
--
Best regards,
Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc
Valentina - Joining Worlds of Information
http://www.paradigmasoft.com
[I feel the need: the need for speed]
More information about the Valentina
mailing list