Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Strategy for Inserting new records using SQL
Message
 
 
À
07/12/2003 12:59:18
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00856690
Message ID:
00856727
Vues:
20
Stefan,

>[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.


I'm not sure what information you're asking for. It was always my understanding that SET RELATION uses implicit SEEK to move records in child tables so all SEEK stuff is applicable to SET RELATION navigation. And I never seen anything to contrary.

>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).

It's documented in VFP help for FOUND() function (bold mine):
FOUND( ) returns a logical value that indicates whether the most recently executed CONTINUE, FIND, INDEXSEEK( ), LOCATE, or SEEK was successful, or if the record pointer was moved in a related table.

For multiple child tables you can specify an alias FOUND("childOne") the same way as for EOF("childOne") )

>
>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.

It baffles me why using EOF() easier to explain than FOUND() which specificly designed to answer exactly the question, was record found or not.
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform