Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- dBsee 4.6 - The Library - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

   This type of transaction allows to modify the value of (some) fields of an
   existing record in a file relationed with the main file. The system
   selects the file on which the transaction is to operate, searchs for the
   indicated record and substitutes the data of the field with a new value.
   It is possible to associate a replace transaction to every insert, modify
   or delete operation made on the main file.

   To explain the functioning of transactions, it is necessary to describe
   the context in which they operate. A transaction can be associated to each
   of the following operations on the main file:

   Write                   Inserting a new record in the main file.

   Update                  Modifying a record in the main file.

   Delete                  Deleting a record in the main file.

   By means of an example, the actual functioning of a transaction will be
   explained and clarified.

Example:

   Let's suppose that the file to which the transaction is to be associated,
   manages the detail rows of a way-bill for the unloading of warehouse
   material. The file that contains the information on the way-bill rows is
   WBRow. Another file, Articles, contains information relative to
   the articles present in the warehouse. Since each way-bill implies a sale,
   the number of articles present in the warehouse must be modified at the
   end of each operation on the WBRow file. The number of articles present in
   the warehouse is contained in the Stock field of the Articles file,
   while the quantity of the articles sold is described in the Qty field
   of the WBRow file.

     . for each row added to the way-bill, the quantity sold must
       be subtracted from the stock present in the Articles file.

     . for each modification of the quantity contained in the row,
       the old value of the Qty field must be added to the Articles file and
       the new value subtracted immediately after.

     . for each row deleted, the stock must be restored.

   The example described can be realised by activating a Replace transaction.
   Once the transaction is defined, dBsee will generate the following code:

     . during Write

     SELECT file Articles
     SEEK the article code referenced in WBRow
     SUBTRACT the quantity indicated in WBRow

     . during Update, after data entry and writing to disk

     SELECT file Articles
     SEEK the article code referenced in WBRow
     ADD the old quantity indicated in WBRow
     SUBTRACT the new quantity indicated in WBRow

     . when in deletion phase, before deleting

     SELECT file Articles
     SEEK the article code referenced in WBRow
     RESTORE the quantity indicated in WBRow

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson