Try OpenEdge Now
skip to main content
Developing WebSpeed Applications
Controlling Database Transactions : SpeedScript components and database transactions : File input

File input

You must be especially careful when you process database transactions that read input from a text file, such as when you populate a database. If a crash occurs, the active database transaction is backed out of the database, but you will not automatically know how far processing proceeded in the text file. To handle this, you must do one of the following:
*Restore the database and rerun the procedures that were running when the system failed.
*Run all data input processes as a single database transaction (this has record locking implications as well as implications in terms of the size of the before-image file for the transaction).
*Have a way to determine how many of the input data lines were processed and committed to the database so that you do not rerun lines that were successfully processed by a procedure.
One technique for doing this is to save the filename and the last line number in a database table, since changes in this status information can be synchronized with the corresponding database updates.