[VSDK.framework] mMyTable.GetRecID() problems after SQL query

Ruslan Zasukhin sunshine at public.kherson.ua
Tue Nov 11 09:49:56 CST 2003


on 11/11/03 5:01 AM, Eric Forget at forgete at cafederic.com wrote:

> Hi Ruslan,
> 
> I've found a weird problem. First, let's look at the code snippet:
> 
> void
> MyDB::GotoRecord(UInt32 index)
> {
>   FBL_REC_ID    recID = (*mArray)(index);
>   
>   if (mMyTable.GetRecID() != recID) {
>   
>       mMyTable.GoToRecord(recID);
>       
>       // May take some time: execute a an SQL statements and then
>       // copy them to FBL_ArraySet members as a cache.
>       UpdateFirstRelatedArray();
>       UpdateSecondRelatedArray();
>   }
> }
> 
> I call it from a lot of places. That's why there is an if statement: to not
> doing things not necessary.
> 
> Unfortunately, the if statement seems to not working. I have a lot weird
> behavior: wrong data is displayed. If I remove the if statement, it seems to
> work fine, just a lot slower. I've tried to remove the index file, without
> success!
> 
> If it could gives you any hint, I'm doing other SQL queries before calling
> MyDB::GotoRecord() that use mMyTable.
> 
> I've tried it with both VSDK.framework 1.9.8 and the just downloaded
> VSDK.framework 1.10b. I cannot guaranty, but I pretty sure it was working
> with last spring versions...

Hi Eric,

You make big mistake when mix BaseObject API and Cursor API.
This can cause problems if do wrong expectations.

When you do some SQL query or use later Cursor they CAN change current
record of Table. You cannot expect that your current record of myTable will
be the same after you do SQL on that table because INTERNALY Valentina also
use that myTable to build cursors.

If you want independent current records you need use CURSORS.

Also I wonder on your caching...why then not keep a cursor itself alive as
long as you need?


-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list