Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Strange TABLEUPDATE behaviour?
Message
From
25/01/2002 10:26:45
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Client/server
Title:
Strange TABLEUPDATE behaviour?
Miscellaneous
Thread ID:
00610484
Message ID:
00610484
Views:
38
This is simplified pseudo code of the program that's giving me problems.
SELECT InputFiles      && Contains a list of files to process
   SCAN
       =SQLEXEC([SELECT * FROM MyRemoteView],MyView) && SQL Server 2K 
       * MyRemoteView Contains MAX(Timestamp) down to milliseconds
       * for all unique records´from it's base table
       * Boy I hope I've explained this properly
       * Anyway, that's why I keep calling the SQLEXEC for every TABLEUPDATE() 
       INDEX ON ...TAG MyTag...
       CREATE Cursor MyCursor ...
       lcFilename=InputFiles.FileName
       APPEND FROM lcFileName
       SCAN
           SCATTER MEMVAR
           IF SEEK(MyExpression,MyView,...);
              AND MyCursor.Timestamp>MyView.Timestamp
              * Compare timestamps to make sure the same stuff does
              * not get added twice
              REPLACE MyView.Timestamp WITH MyCursor.Timestamp
              REPLACE some values in MyView with some other values
           ELSE
              INSERT INTO MyView FROM MEMVAR
           ENDIF
           * Increment the number of observations with 1
           REPLACE MyView.NumerOfObs WITH MyView.NumerOfObs+1
       ENDSCAN

       * We have now processed 1 inputfile, update MyView
       	llResult=TABLEUPDATE(2,.T.,"MyView",Errors)

       * Check if the update returns .T. and handle any records
       * that did not make it through...  

        SELECT InputFiles
ENDSCAN
Now what happens, in all cases so far, TABLEUPDATE returns .T.
The debugger tells me that my MyView has incremented the NumberofObs to the expected value and everything looks fine.

When I use the SQL Server Query analyzer and open the SQL Server view, it quickly becomes clear that not everything was updated.

The very first file on an empty MyView and base table makes it through ok.

After that, most records are ok and have indeed been inserted and/or updated, but some are not.

I have not been able to find any pattern in the ones that are not, it all seems pretty random.

Any ideas?

TIA
BTW, I do set the KeyFields, Tables and all the other properties, so that's not it.
Peter Pirker


Whosoever shall not fall by the sword or by famine, shall fall by pestilence, so why bother shaving?

(Woody Allen)
Next
Reply
Map
View

Click here to load this message in the networking platform