Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Transactions - Do the work on straight VFP tables?
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Transactions - Do the work on straight VFP tables?
Miscellaneous
Thread ID:
00803063
Message ID:
00803063
Views:
37
Hey all,

I am mightily confused. Consider, if you will, the following code:
CLOSE DATABASES ALL

SET MULTILOCKS ON

USE c:\docket SHARED

CURSORSETPROP('Buffering', 5, 'docket')

SUSPEND

SELECT docket
UPDATE docket SET case_no = 'FOUR'
BEGIN TRANSACTION
IF TABLEUPDATE(.T., .T., 'docket')
	ROLLBACK
	TABLEREVERT(.T., 'docket')
ENDIF

RETURN .T.
Pretty simple, right? I am testing if a ROLLBACK will work to stop changes in the docket work area.

After the SUSPEND, I step through. After the UPDATE statement, I use another session of VFP to look at the docket table. No changes yet. Good. That's what I expect, as the buffered cursor is holding the changes, not the table.

Then I BEGIN TRANSACTION and do a TABLEUPDATE(). After the TABLEUPDATE I check my table again from the other VFP session. The changes are there. I find this sort of weird, since most transactions stop writing from occuring in the first place instead of trying to take it back later. No matter, I figure Fox must do it differently, rolling back the changes in the event of a ROLLBACK.

So, I step one more line and execute the ROLLBACK. My data in the other session still shows the changes after a complete close and re-open of the table. The changes are there. What is going on? ROLLBACK appears to be entirely ineffectual! The TABLEREVERT() was added in just because I saw it in the help file, but it doesn't make any difference, and I wouldn't expect it to as far as the back-end data goes.

Can anyone tell me what I am forgetting? A SET command? Something else with CURSORSETPROP()? I am sure I have had transaction working before, and now I can't even get the simplest example to work...

Please help! I appreciate it! (Dan, if you are reading, don't laugh at my stupidity...this really has me stumped right now... *smile*)

JoeK
Next
Reply
Map
View

Click here to load this message in the networking platform