Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Record pointer movement on UPDATE command
Message
De
25/10/2007 20:45:29
 
 
À
25/10/2007 16:42:58
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01263679
Message ID:
01263902
Vues:
11
>>I have inherited some code which does UPDATEs within a SCAN loop and we're finding not all records are being processed.
>>
>>My testing seemed to lead to the following conclusions on where the record pointer will be after an SQL UPDATE command.
>>UPDATE myTable SET myField = value WHERE condition
>>If condition is optimizable (doesn't seem to matter if fully or partially) then the record pointer will be at the last physical record which meets condition
>>
>>If condition is not optimizable the record pointer will be at the last physical record in the table.
>>
>>It doesn't matter if the index used to optimize the query is ASCE or DESC.
>>
>>It doesn't matter if there is an active index on the table.
>>
>>I'm pretty sure I know how to fix the code,
>
>...by making it independent of recno()...
>
>> but I'd appreciate somebody verifying my conclusions on the record pointer movement.
>
>I don't remember writing code which would make any assumptions about the record pointer after an Update, but what you wrote fits snugly with what I've learned so far about Rushmore: if it's optimizable, it means it reads indexes to find records to work on; if not, it still has to go through all the records. Set Order doesn't enter into equation in the case of SQL statements (select, update, delete, insert) as it's scoped to an alias and these statements usually open the tables again to work on them, under a temporary alias for the duration of their action.
>
>So it does make sense to me - it's as it should be.

Thanks for the reply.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform