Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Recno() after Tablerevert() question
Message
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01448538
Message ID:
01448564
Views:
32
>>>>Hi,
>>>>
>>>>I am trying to understand something about how VFP moves record pointer during update. I have tracked the following change but need to understand what happens:
>>>>
>>>>1. The program adds a new record to a table (the table has 100 records). The new record gets RECNO() -1.
>>>>2. For whatever reason TABLEUPDATE() fails (e.g. duplicate key field)
>>>>3. After call to TABLEREVERT() the current record RECNO() is now 101. And it looks like the record is completely empty, that is as if the record pointer moved to a phantom record (next to EOF().
>>>>
>>>>Is this how VFP works by design? Could someone explain this?
>>>>
>>>>TIA>
>>>
>>>I always save current record before tableupdate and if it's within the 1 and reccount('MyAlias') restore it back after tableupdate. The tableupdate moves pointer to EOF.
>>
>>When I was "monitoring" the record pointer I noticed that the record pointer after tableupdate() was still -1 and only after tablerevert() it changed to 101. I understand that I can save records/restore records. But I am trying to understand why things work the way they do to find the approach that will work for me. One thing that is puzzling is why the record pointer (recno()) changed from -1 to 101. Maybe someone who knows how VFP works under the hood will chime in.
>>
>>Thank you.
>
>Alexey (who knows how VFP works under the "hood") doesn't visit this forum anymore. I know that tableupdate moves the record pointer (at least if it's successful).

I don't think VFP "moves" the record pointer. After tableupdate() is successful VFP assigns a new number to the RECNO() but nothing physically is moved. But in my case, of tablerevert(), it seems like VFP actually moves the pointer to a new (phantom) position.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform