table.BATCH_END Function
Syntax
V Batch_End()
Description
Unlocks database file after batched changes.
Discussion
The <TBL>.BATCH_END() method terminates the special optimized batch operation that was started by <TBL>.BATCH_BEGIN(). Enter and Change operations on the specified table after a <TBL>.BATCH_END()are not optimized.
This script updates the Product table, both with and without the batch optimization.
tbl = table.open("c:\A5\a_sports\product.dbf") t1 = toseconds(time()) tbl.fetch_first() while .NOT. tbl.fetch_eof() tbl.qty = 0 tbl.change_end(.T.) tbl.fetch_next() end while t2 = toseconds(time()) trace.writeln("Trial 1 - Seconds elapsed:" + str(t2-t1)) t1 = toseconds(time()) tbl.batch_begin() tbl.fetch_first() while .NOT. tbl.fetch_eof() tbl.change_begin() tbl.qty = 1 tbl.change_end(.T.) tbl.fetch_next() end while tbl.batch_end() t2 = toseconds(time()) trace.writeln("Trial 2 - Seconds elapsed:" + str(t2-t1)) tbl.close()
See Also