VCursor lock question - 2d try

Fran=?ISO-8859-1?B?5w==?=ois Van Lerberghe frvanlerberghe at gmail.com
Tue Oct 8 15:02:47 CDT 2013


Hi Joseph,
Thank you to your reply. Unfortunately, this doesn't solve my problem.

I have one cursor locked in RW mode (containing all records of one table)
and next I need to make a second cursor to modify some records (50) of that
table. As explained before I see 3 ways to do this. Witch one do you think
it's better ?

François Van Lerberghe
Rue Thier Monty, 15 A
4570 Marchin
+32 (0)85 25 08 25


le 8/10/13 18:44, Joseph Morgan <joseph at checkos.com> a écrit :

> I am not sure what to do in this situation. But I saw this on xojo forum and
> maybe you can adapt their solution to your needs:
> 
> https://forum.xojo.com/5486-how-best-to-handle-updating-one-field-in-a-bunch-o
> 
> 
> I hope this helps. :)
> 
> Joseph
> 
>> On Oct 8, 2013, at 11:38 AM, François Van Lerberghe
>> <frvanlerberghe at gmail.com> wrote:
>> 
>> As nobody answer my question, let me post it again :
>> 
>> I have a function (RealBasic/Xojo method) where I update every record of a
>> table (5000 records). In order to do that, I make a VCursor with
>> EVLokType.kReadWrite on the whole table.
>> At the end of this function , I call another function to update a few
>> records (50) of that same table. This update is in another function because
>> it is called by some other places of the project. How must I deal with the
>> records locking in this second Vcusor using the same table, but not the same
>> records ?
>> 
>> 1) If I nil the first Vcursor (locking the whole table) before create the
>> second, locking the needed records, I have a risk (very low I know, but that
>> exist) that, just before I create my second Vcursor, another user lock some
>> records of that table, reading or writing incorrect data and stopping me to
>> complete the work.
>> 
>> 2) Must I keep the first Vcursor ensuring that nobody can modify the table
>> and create the second with kNoLock ? Is it safe to update the records in
>> this second Vcursor ?
>> 
>> 3) I see a third option : Keeping the first cursor. I pass this Vcursor as
>> parameter to iterate, test each record and update the records that meet some
>> condition. I don't like this option as
>> - I prefer sending a second SQL query to retrieve the needed records rather
>> than iterate and test each record
>> - this second function is called by some other places of the project
>> 
>> I prefer the second option if it is safe. Could you be kind enough to give
>> me your advice on this ?
>> 
>> François Van Lerberghe
>> Rue Thier Monty, 15 A
>> 4570 Marchin
>> Belgium
>> 
>> _______________________________________________
>> Valentina mailing list
>> Valentina at lists.macserve.net
>> http://lists.macserve.net/mailman/listinfo/valentina
> 
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina
> 



More information about the Valentina mailing list