home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 125.img / PRO-C4.ZIP / BENCH1.ZIP / GENSUP / TRANS.C < prev   
Encoding:
C/C++ Source or Header  |  1990-05-28  |  757 b   |  60 lines

  1.  
  2. # include <stdio.h>
  3. # include <bench.h>
  4. # include <proc.io>
  5. # include "field.h"
  6. # include "screen.h"
  7. # include "iodef.h"
  8. # include "sup.h"
  9.  
  10.  
  11. int pending = 0;
  12.  
  13. void tran_p(tab)
  14. struct _table *tab;
  15. {
  16.     if (pending)
  17.         return;
  18.  
  19.     /*
  20.      * Switch on Transaction Processing for the duration
  21.     */
  22.     transact(tab->fd);
  23. }
  24.  
  25. void roll_p(tab)
  26. struct _table *tab;
  27. {
  28.     if (!pending)
  29.         return;
  30.  
  31.     if (tab->query_box)
  32.     {
  33.         if (warning (99, TRN_ROLLBACK))
  34.             rollback(tab->fd);
  35.     }
  36.     else
  37.         rollback(tab->fd);
  38.  
  39.     pending = FALSE;
  40. }
  41.  
  42. void comm_p(tab)
  43. struct _table *tab;
  44. {
  45.     if (!pending)
  46.         return;
  47.  
  48.     if (tab->query_box)
  49.     {
  50.         if (warning (99, TRN_COMMIT))
  51.             commit(tab->fd);
  52.     }
  53.     else
  54.         commit(tab->fd);
  55.  
  56.     pending = FALSE;
  57. }
  58.  
  59.  
  60.