Locks

Thomas Flemming tf at ttqv.com
Mon Nov 2 11:39:06 CST 2009


Hi Ruslan,


> Hi Thomas,
> 
>> I'm just wondering if this is correct:
>>
>> I have multiple forms displaying data of the same table.
>> For this I use several cursors like this, which are open the whole until the
>> program ends:
>>
>> mCur = mDB.SqlSelect(mSQL, kClientSide, kNoLocks, kRandom)
>>
>> This works.
>>
>>
>> To edit some values in the table I temporarily create a new cursor:
>>
>> cur = mDB.SqlSelect("select * from [mytable], _
>>                      kServerSide, kReadWrite, kForwardOnly)
>> cur.Position = position_to_edit
>> cur.Field(1).Value = newvalue1
>> cur.Field(2).Value = newvalue2
>> cur.UpdateRecord()
>> cur.Dispose()
>>
>> It also works, but is it the right way?
> 
> A) Better select in the second cursor only ONE record, which you want to
> edit
> 
>     SELECT ... FROM T ... WHERE RecID = XXX

Ok.

> 
> B) it is possible also to use just UPDATE command
> 
>     UPDATE ...  fld1 = value1  ... WHERE RecID = XXX
> 
> 
> C) And it is possible to use both these ways with SQL binding
> 
>     "UPDATE T SET fld1 = :1, WHERE RECID = :5"
> 
> See example SQL Binding and read wiki about why this can be better.

Somehow I couldnt find anything in the wiki, that explains kServerSide, 
kClientSide and the three locks.


Regards,
Tom


> 
> 

-- 
/****************************************
**   Dipl.-Ing. Thomas Flemming
**   Software Development
**
**   Touratech AG
**   Auf dem Zimmermann 7-9
**   D-78078 Niedereschach
**
**   mail  tf at ttqv.com
**   fon   +49 (0) 7728 9279-206
**   fax   +49 (0) 7728 9279-29
**
**   http://www.ttqv.com
**   http://www.touratech.de
**
**   ... und immer dem Pfeil nach!
***************************************/


More information about the Valentina mailing list