home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.databases.informix
- Path: sparky!uunet!gumby!destroyer!ubc-cs!mprgate.mpr.ca!sandie
- From: sandie@mprgate.mpr.ca (Bert Sandie)
- Subject: ESQL/C Program - Get First, Get Next Record in Table
- Message-ID: <1992Aug13.223405.21215@mprgate.mpr.ca>
- Originator: sandie@atom
- Keywords: ESQL/C, Cursors, Select, First, Next
- Sender: news@mprgate.mpr.ca
- Organization: MPR Teltech Ltd., Burnaby, B.C., Canada
- Date: Thu, 13 Aug 92 22:34:05 GMT
- Lines: 58
-
- Hi Netters,
-
- I was wondering if anyone can help me out with what I think is
- a problem with using ESQL/C to perform a get first and get next
- operation from a C program.
-
- The program has two routines call Get_First and Get_Next which
- are used to retrieve records from a table based on a specified
- selection criteria. The Get_First and Get_Next routines are
- used in many other routines to retrieve records based on a
- specified selection criteria. The problem is if I have a
- parent function as such:
-
- FUNCTION A
- Begin
-
- table_name = 'FOOBAR'
- selection_criteria = 'A*'
-
- Get_First(table_name, selection_criteria, return_record)
-
- While ( return_record.field1 != xx) Do
- Begin
-
- Get_Next(table_name, selection_criteria, return_record)
-
- End
- End
-
- FUNCTION Get_First
- BEGIN
-
- Use Cursor to retrieve records which match selection_criteria
-
- Return First Record in cursor
-
- END
-
- FUNCTION Get_Next
- BEGIN
-
- Use Cursor to retrieve records which match selection_criteria
-
- Return Next record in cursor /* <=== PROBLEM */
-
- END
-
- The PROBLEM is how do you know which is the next record, after the
- first record is retrieved, or for subsequent records for that matter?
-
- Any advice would be appreciated,
-
- Thanks,
-
- Bert Sandie
- MPR TELTECH LIMITED
- Burnaby, BC, Canada
- EMAIL: sandie@mprgate.mpr.ca
-