home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / PROCWRKB.ZIP / BENCH1.ZIP / GENSUP / TRANS.C < prev   
Encoding:
C/C++ Source or Header  |  1990-08-07  |  1.3 KB  |  73 lines

  1. /* ==( gensup/trans.c )== */
  2. /* ----------------------------------------------- */
  3. /* Pro-C  Copyright (C) 1988 - 1990 Vestronix Inc. */
  4. /* Modification to this source is not supported    */
  5. /* by Vestronix Inc.                               */
  6. /*            All Rights Reserved                  */
  7. /* ----------------------------------------------- */
  8. /* Written   Nig   1-Jan-90                        */
  9. /* Modified  Nig   1-Jan-90                        */
  10. /* ----------------------------------------------- */
  11. /* %W%  (%H% %T%) */
  12.  
  13.  
  14.  
  15. # include <stdio.h>
  16. # include <bench.h>
  17. # include <proc.io>
  18. # include "field.h"
  19. # include "iodef.h"
  20. # include "sup.h"
  21. # include "screen.h"
  22.  
  23.  
  24. int pending = 0;
  25.  
  26. void tran_p(tab)
  27. struct _table *tab;
  28. {
  29.     if (pending)
  30.         return;
  31.  
  32.     /*
  33.      * Switch on Transaction Processing for the duration
  34.     */
  35.     transact(tab->fd);
  36. }
  37.  
  38. void roll_p(tab)
  39. struct _table *tab;
  40. {
  41.     if (!pending)
  42.         return;
  43.  
  44.     if (tab->query_box)
  45.     {
  46.         if (warning (99, TrnRollBack))
  47.             rollback(tab->fd);
  48.     }
  49.     else
  50.         rollback(tab->fd);
  51.  
  52.     pending = FALSE;
  53. }
  54.  
  55. void comm_p(tab)
  56. struct _table *tab;
  57. {
  58.     if (!pending)
  59.         return;
  60.  
  61.     if (tab->query_box)
  62.     {
  63.         if (warning (99, TrnCommit))
  64.             commit(tab->fd);
  65.     }
  66.     else
  67.         commit(tab->fd);
  68.  
  69.     pending = FALSE;
  70. }
  71.  
  72.  
  73.