home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / database / informix / 1720 < prev    next >
Encoding:
Text File  |  1992-08-13  |  1.7 KB  |  71 lines

  1. Newsgroups: comp.databases.informix
  2. Path: sparky!uunet!gumby!destroyer!ubc-cs!mprgate.mpr.ca!sandie
  3. From: sandie@mprgate.mpr.ca (Bert Sandie)
  4. Subject: ESQL/C Program - Get First, Get Next Record in Table
  5. Message-ID: <1992Aug13.223405.21215@mprgate.mpr.ca>
  6. Originator: sandie@atom
  7. Keywords:  ESQL/C, Cursors, Select, First, Next
  8. Sender: news@mprgate.mpr.ca
  9. Organization: MPR Teltech Ltd., Burnaby, B.C., Canada
  10. Date: Thu, 13 Aug 92 22:34:05 GMT
  11. Lines: 58
  12.  
  13. Hi Netters,
  14.  
  15. I was wondering if anyone can help me out with what I think is
  16. a problem with using ESQL/C to perform a get first and get next
  17. operation from a C program.
  18.  
  19. The program has two routines call Get_First and Get_Next which
  20. are used to retrieve records from a table based on a specified
  21. selection criteria.  The Get_First and Get_Next routines are
  22. used in many other routines to retrieve records based on a
  23. specified selection criteria.  The problem is if I have a
  24. parent function as such:
  25.  
  26. FUNCTION A
  27. Begin
  28.  
  29.    table_name = 'FOOBAR'
  30.    selection_criteria = 'A*'
  31.  
  32.    Get_First(table_name, selection_criteria, return_record)
  33.  
  34.    While ( return_record.field1 != xx) Do
  35.    Begin
  36.  
  37.      Get_Next(table_name, selection_criteria, return_record)
  38.  
  39.    End
  40. End
  41.  
  42. FUNCTION Get_First
  43. BEGIN
  44.  
  45.     Use Cursor to retrieve records which match selection_criteria
  46.  
  47.     Return First Record in cursor 
  48.  
  49. END
  50.     
  51. FUNCTION Get_Next
  52. BEGIN
  53.  
  54.    Use Cursor to retrieve records which match selection_criteria
  55.       
  56.    Return Next record in cursor /* <=== PROBLEM */ 
  57.  
  58. END
  59.  
  60. The PROBLEM is how do you know which is the next record, after the
  61. first record is retrieved, or for subsequent records for that matter?
  62.  
  63. Any advice would be appreciated,
  64.  
  65. Thanks,
  66.  
  67. Bert Sandie
  68. MPR TELTECH LIMITED
  69. Burnaby, BC, Canada
  70. EMAIL: sandie@mprgate.mpr.ca
  71.