home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / database / ingres / 2150 < prev    next >
Encoding:
Text File  |  1993-01-01  |  4.6 KB  |  107 lines

  1. Newsgroups: comp.databases.ingres
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!swrinde!gatech!paladin.american.edu!darwin.sura.net!uvaarpa!cv3.cv.nrao.edu!mail-to-news-gateway
  3. From: GOLD@ILP.MIT.EDU (Mark D. Gold)
  4. Subject: Help - ABF/4GL questions.
  5. Message-ID: <921231133516.8e63@ILP.MIT.EDU>
  6. Sender: root@nrao.edu (Operator)
  7. Organization: National Radio Astronomy Observatory
  8. Date: Thu, 31 Dec 1992 18:35:16 GMT
  9. Lines: 96
  10.  
  11. Hi!
  12.  
  13. I'm having several problems writing 4GL procedures.  I was hoping 
  14. that an INGRES expert could point me in the right direction.
  15.  
  16. 1.  One 4GL procedure does the following work:
  17.  
  18.     a.  create temporary table x
  19.  
  20.     b.  3 large, complex inserts (with selects) into table x
  21.  
  22.     c.  3 large, complex select loops which each have
  23.             REPEATED inserts into table x within the loops
  24.             (the select loops also call C procedures)
  25.  
  26.         d.  create array z, in which is stored a large list of id#s
  27.  
  28.     e.  unload array z statement with 7 REPEATED insert
  29.             statements into table x within the unload statement
  30.  
  31.         f.  modify table x to heapsort on....
  32.  
  33.     g.  call report passing temporary table.
  34.  
  35.  
  36.     If I use REPEATED INSERTS throughout the 4GL procedure, the 
  37. procedure runs approximately 4 times faster than when I just use 
  38. regular INSERTS (i.e., 15 minutes : 1 hour).  However, I need to be 
  39. able to define the name of the temporary table ("table x" above) at 
  40. the start of the 4GL procedure based on the username and sessionid 
  41. using dbmsinfo.  This means (I assume) that I would have to store the 
  42. temporary table name in a variable at the start of the 4GL procedure. 
  43. Unfortunately, I can't use a REPEATED INSERT into a tablename that is 
  44. stored in a variable, even though the variable will not be changing 
  45. thoughout the 4GL procedure.
  46.  
  47. This limitation means that we have to either (1) live with an 
  48. extremely slow 4GL procedure, or (2) hard-code the temporary table 
  49. name into the 4GL procedure, which means that each username will have a 
  50. copy of that temporary table AND only one person at a time logged 
  51. onto the same account will be able to use the temporary table.
  52. Option #1 is unacceptable for us.  
  53.  
  54. We were planning to create one username for each company that might 
  55. use our database.  Several employees of the company can be logged on 
  56. the same username (account) at once.  If we hard-code the temporary 
  57. table name into the 4GL procedure (Option #2), we will have to make 
  58. certain that two users logged on to the same account cannot use the 
  59. 4GL procedure at the same time.
  60.  
  61. Does this mean that I have to take out an exclusive table lock on the 
  62. temporary table (set lockmode on tablename where readlock = exclusive)
  63. to keep another user on the same account from running the 4GL 
  64. procedure?  How can I see if the temporary table is locked 
  65. by another user at the start of the 4GL procedure so that I can tell 
  66. the second user to try again later?
  67.  
  68. One developer suggested that I DON'T use INGRES locking to prevent 
  69. two users in the same account from using the 4GL procedure, but 
  70. that I create my own locking table for the database that inserts a 
  71. row for a username when the 4GL procedure is being used and deletes 
  72. the row when the procedure finishes.  She didn't think that relying 
  73. on INGRES locking for what I wanted to do was a good idea.  Any 
  74. thoughts?  However, how would I delete a row in this lock table if 
  75. the user CTRL-Y's or CTRL-C's out of the application?
  76.  
  77. 2.  I need to be able to run a clean_up procedure specific to each 
  78. 4GL procedure if a user CTRL-Y's, CTRL-C's, or F6's (VMS) interrupts 
  79. out of my application.  This local clean_up procedure would include 
  80. deleting rows from various temporary tables and setting flags on 
  81. other tables.
  82.  
  83. I already do this for INGRES errors at the end of each transactions:
  84.  
  85.              INQUIRE_INGRES (h_error=errorno,
  86.                              row_count=rowcount);
  87.                 IF :h_error != 0 THEN
  88.                     CALLPROC err_message
  89.                        (error_num =e$fatal_error,
  90.                         form_name = :cur_frame);
  91.                     ROLLBACK;
  92. =================>> ret_code = CALLPROC clean_up;
  93.                     RETURN r$error;
  94.                 ELSE
  95.                     COMMIT;
  96.                 ENDIF;
  97.  
  98. but I don't know how to capture any of the possible interrupts 
  99. (CTRL-Y, CTRL-C, F6) and the rollback and then run my clean_up 
  100. procedure.  Any ideas would be greatly appreciated.
  101.             - Mark
  102. --------------------------------------------------------------
  103. Mark D. Gold             Massachusetts Institute of Technology
  104. gold@ilp.mit.edu         Industrial Liaison Program
  105. (617) 253-0430           Cambridge, Massachusetts  02139
  106.  
  107.