Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Update Conflict
Message
From
05/10/2004 05:47:19
 
 
To
04/10/2004 15:11:44
Joel Hokanson
Services Integration Group
Bellaire, Texas, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00948110
Message ID:
00948737
Views:
18
Joel

I was asking if somewhere outside your critical code you had a (VFP) begin .. end transaction. It's nothing to do with SQL but can be used with any transaction processing. Typically it would be used for, say, a large update to a table.

Suppose you absolutely need ALL updates to have taken place ... or your database becomes screwed. Suppose half way through one of the updates fails - you've already committed some changes with tableupdate - so your db is now screwed.

You can bracket the whole xaction process with Begin Transaction ... End Transaction. You can test for success of your updates with tableupdate() and, if one fails, you can rollback the whole lot and the db is back as it was. If not you end the xaction and all your changes are committed.

e.g. (primitive example)
Select MyTable
Locate
llSuccess = .T.
Begin transaction

Do while llSuccess
  Replace MyField with "Hello" in MyTable
  llSuccess = TABLEUPDATE(.T.)
  Skip
EndDo

If llSuccess
    End Transaction
Else
    RollBack
EndIf
This is part. useful in large updates where, say, there may be a power failure half way through. Typically, if your prog should fail, say due to a bug, before End Transaction then, when you try to close your table you get the error you mentioned "uncommitted changes".
There's a full discussion on this in Help
Hope this may be of help

Terry

>Terry,
>You said:
> Is your update bracketed by Begin Trans somewhere, without the end trans. That's the sort of message one gets if this is the case. Just a thought.
>
>Terry
>
>I had asked about an error whe3n I do replace all in a View with =CursorSetProp('Buffering',5,'ap_wires_work_orders')]
>>and after the replace all is complete, I do a Tableupdate()
>
>I do not have any begin or end transaction.
>
>Normally I just update one record then do a Tableupdate() but in this case I had hoped to replace ALL (25,000 records).
>
>How do I make this into a begin/end transaction?
>
>
>SORRY to not be more knowledable about using SQL
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Previous
Reply
Map
View

Click here to load this message in the networking platform