Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Strategy for Inserting new records using SQL
Message
From
07/12/2003 12:59:18
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00856690
Message ID:
00856709
Views:
14
[EOF("detail") in a relation when there are no details for the master record]
> The code below may produce incorrect result if SET NEAR set to ON.

Sergey, could you give give pointers to MSKB articles or UT threads covering this issue? This is something serious that I should learn about pronto.

Meanwhile, I am not really comfortable with using FOUND() for this because documentation says nothing about it being relevant in a relationship context, much less how (there could be several detail tables, for example).

I would suggest the solution which I originally used but that I replaced with EOF() because the latter seemed more straightforward/'correct' in this situation:
scan for stock.units <> stock_previous.units
   if stock.number <> stock_previous.number  && PK difference -> new record
      ...
My main reason for replacing this was that it is not as straightforward to explain as EOF(). ;-) Also, this depends on a 'blank' stock.number not being in use as key for an existing record. Although this is not an entirely unreasonable assumption I felt that cluttering the article with things like that would have distracted from its main thrust as an example.

> Also, I'm unaware of SCAN...ENSCAN locking any records and there's nothing
> in the help abput that. Can you provide some code that proves your statement?

I do not remember the specifics but a while back I solved a locking-related multi-user performance problem by replacing SCAN loops with DO WHILE ... SKIP loops. I don't even remember whether SCAN was the victim or the offender in that situation, but it was definitely a key ingredient. I'll try to look it up when I get to work tomorrow.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform