Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Strange TABLEUPDATE behaviour?
Message
From
28/01/2002 10:20:11
 
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00610484
Message ID:
00611546
Views:
15
Hector,

I've played around with it as you suggested, but nothing seems to help.

Now, the view I'm working against, initially contains some records that are updated in the course of the program.

Other records are first inserted and, again in the course of the aggregation, may be updated severeal times.

All this happens before a TableUpdate is being issued.

If there is a pattern to all this, it seems as if the records that are in the view when it is called initially, are not properly updated, while the newly inserted/updated stuff makes it through.

TIA

>I have seen weird behaviors with TableUpdate myself. Some of the things that have caused me trouble are:
>
>* Using TableUpdate() with numeric parameters. Althought this is what the help recommends, I've found that using the numeric valid does not always work. I try to use instead TableUpdate( .T. )
>
>* If you use TableUpdate() with numeric parameters. You may need to loop several times until getnextmod() returns 0 to make sure all your changes were commited. I know this does not make sense since TableUpdate() should be able to process all records at once, but I have found that sometimes TableUpdate() does not work as expected.
>
>* Check the value in BatchUpdate. The default is 1 and everything works fine with that value. I've found that changing that value causes sporadic (random?) problems with TableUpdate().
>
>I hope this helps.
>
>>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)
Previous
Reply
Map
View

Click here to load this message in the networking platform