Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Rolling back input done via insert into and replace cmds
Message
De
14/04/2003 11:50:29
 
 
À
14/04/2003 11:35:05
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00777224
Message ID:
00777250
Vues:
9
Look in the help under 'BEGIN TRANSACTION'. On the other hand, now that I've re-read it myself, I think it's referring to table modification and not the insert sql command. So you should be ok.

You need to enclose all of the transactions between a begin and end transaction structure. If no errors occur, you'll issue the END TRANSACTION, otherwise, you'll issue the ROLLBACK.

However, your tables MUST be included in a DBC, and I imagine they'll need to be buffered. The reason I sound a little vague on the buffering is that I only use buffered sql views myself. I don't do any direct writing to tables.

You do need to do 'tableupdate' in order to write out the information. In fact it is on the tableupdate that you'll likely receive the indication of error.

The Begin/end structure will take care of any necessary locking, and you shouldn't need a tablerevert, since the rollback will do it for all the tables involved in the process.

Alan

>>According to the help file, you cannot issue an INSERT command to a table involved in a BEGIN/END transaction. So I think if you have to stay with the insert, you're out of luck.
>
>Where is that documented (I looked and I must have missed it).
>
>What are the alternatives? Would a combination of Append blank and Replace be better?
>
>>
>>Alan
>>
>>>This is an existing application worked on by many people, now it's my turn. Basically it is an input form for issuing stock items.
>>>VFP 7, Save data via a save button on a form, Dataseesion set to 2 (private), Buffering set to none, 3 shared tables are used, and ordered items are save in a temporary table on the user's PC. To save an issue slip the current approach is to
>>>
>>>1. get next slip number for requisitions header table
>>>2. use instert into command to append a new record into the header table
>>>3. a. scan temp items ordered table for stock number of ordered items
>>> b. lock record in inventory table
>>> c. use replace command to update inventory table (i.e. decrease amount on hand)
>>> d. use insert into command append a record into detailed requitions table
>>> e. unlock record in inventory table
>>>
>>>This contains no error checking and works 95% of the time, but occationally it fails. I would like to add checks to be sure all updates and appends work, but I am not sure of the best approach to do this. In particular how do I check if insert into commands worked and if it failed how to I rollback the entire process. For example
>>>
>>>1. Do I have to lock both the requisition header and detail tables, or since next issue slip number comes from the header table do lock just the requisions table?
>>>2. Do I use tableupdate command after the insert into commands?
>>>3. Does the rollback command also undo insert into commands?
>>>4. Where do I need to use the tablerevert command?
>>>
>>>Any suggestions/help appreciated.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform