home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / database / informix / 2328 < prev    next >
Encoding:
Text File  |  1992-11-06  |  2.4 KB  |  81 lines

  1. Path: sparky!uunet!ukma!darwin.sura.net!europa.asd.contel.com!emory!emory!not-for-mail
  2. From: randy@turq.b8.ingr.com (Randy Paries)
  3. Newsgroups: comp.databases.informix
  4. Subject: Help with structs and .ec
  5. Date: 5 Nov 1992 15:03:08 -0500
  6. Organization: Mailing List Gateway
  7. Lines: 66
  8. Sender: walt@mathcs.emory.edu
  9. Distribution: world
  10. Message-ID: <1dbulsINNqte@emory.mathcs.emory.edu>
  11. Reply-To: randy@turq.b8.ingr.com (Randy Paries)
  12. NNTP-Posting-Host: emory.mathcs.emory.edu
  13. X-Informix-List-ID: <list.1574>
  14.  
  15. Hi,
  16.  
  17.     I having problems fetching into a structure when using a prepare.
  18.     I will explain.
  19.  
  20.     /*------------------------------------------------------------*/
  21.     $struct open{
  22.         int  var1;
  23.         int  var2;
  24.         char var3;
  25.     };
  26.     $struct open open_rec;
  27.  
  28.     main()
  29.     {
  30.         $declare X cursor for
  31.             select * from table where table.var1 = 2;
  32.         $open;
  33.         $fetch X into $open_rec;
  34.     }
  35.     /*------------------------------------------------------------*/
  36.     This above example works ok. The following example fails on the
  37.     compile with the following error:
  38.     line 13: RECORD objects 'open_rec' are not allowed in this list
  39.     /*------------------------------------------------------------*/
  40.     $struct open{
  41.         int  var1;
  42.         int  var2;
  43.         char var3;
  44.     };
  45.     $struct open open_rec;
  46.  
  47.     main()
  48.     {
  49.         char qvar[200];
  50.  
  51.         strcpy(qvar,"select * from table where table.var1 = 2");
  52.  
  53.         $prepare Y from $qvar;
  54.         $declare X cursor for Y;
  55.         $open;
  56.         $fetch X into $open_rec;
  57.     }
  58.     /*------------------------------------------------------------*/
  59.     
  60.     if I replace $fetch X into $open_rec; with
  61.              $fetch X into $open_rec.var1,$open_rec.var2,$open_rec.var2
  62.     it works ok.
  63.  
  64.     The problem is the tables that I need to fetch in real life have
  65.     LOTS of columns.  
  66.  
  67.  
  68.  
  69.     Thanks for any help..
  70. -- 
  71. ------------------------------------------------------------------------     
  72.  |--------------|            #          -------------------------------|
  73.  | Randy Paries |       ____/|   _______| b8!turq!randy                |
  74.  | x6191   cr041|        \ oO|  /       | uunet!ingr!b8!turq!randy     |
  75.  |--------------|    ##   | ~|_/ ##     | randy@turq.b8.ingr.com       |
  76.                     ####  `-U'  ####    |Intergraph, Huntsville Alabama|
  77.                        \\  ||  //       ================================
  78.  TEAM "CATS"             \/  \/ ples exuse al speln mstaks
  79. "Smells like team spirit" |  | 
  80. ------------------------------------------------------------------------     
  81.