Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!utgpu!water!watmath!clyde!cbosgd!cwruecmp!hal!ncoast!allbery
From: allbery@ncoast.UUCP
Newsgroups: comp.databases
Subject: Re: Big fun w/Informix cursors.
Message-ID: <2908@ncoast.UUCP>
Date: Tue, 14-Jul-87 23:52:52 EDT
Article-I.D.: ncoast.2908
Posted: Tue Jul 14 23:52:52 1987
Date-Received: Fri, 17-Jul-87 06:34:06 EDT
References: <147@paisano.UUCP> <3219@ptsfa.UUCP>
Reply-To: allbery@ncoast.UUCP (Brandon Allbery)
Followup-To: comp.databases
Organization: Cleveland Public Access UN*X, Cleveland, Oh
Lines: 43

As quoted from <3219@ptsfa.UUCP> by bh@ptsfa.UUCP (Brian Holliday):
+---------------
| >queried list of rows from a given declare statement.  Although fetch
| >does a fine job in the forward direction, there seems to be no way to
| >do what I would imagine would best be called an 'unfetch'.  Ie, is it
| >possible to back the cursor up a row (or more) to traverse already
| >fetched data? It would certainly seem to be a nice thing to be able to do,
| >and in fact is quite possible from the vanilla Informix generated screens.
| 
| You are correct -- cursors take you forward through your database
| selections, and there is no way to step backwards, and ask for a previously
| fetched selection.  I used vanilla Informix 3.3 before I used Informix 4GL,
| so this apparent brain damage affected me in the same manner it has affected
| you ([insert favorite 4-letter word here]!).  However, now that I know 4GL
| much better, I immensely prefer it over the vanilla Informix.   Since 4GL
| programming is so much easier and more productive than vanilla Informix, I
| accept the work-around.
+---------------

I've used Informix 3.3 and Informix-4GL, as has my boss at my new job; we
both prefer Informix 3.3, and he's to the point of actually considering
switching to UNIFY to keep the C interface:  which, for him, is almost
blasphemy.

The next (soon, maybe now?) version of Informix-4GL is supposed to have
bidirectional cursors.  My solution finessed both of the original poster's
problems:  I do a "foreach cursor into c_rowid call saveit(c_rowid)" loop,
where saveit() is a C routine which writes the rowid into a binary file in
/tmp.  Other routines exist to append and delete entries in the temp file
and to step forward and backward; I use it with some shell scripts which
write 4GL "Perform"-like programs.  (My own opinion of the deficiency?
Considering that the "read" routines are called "frstrec", "nextrec",
"prevrec", "lastrec", they should be obvious to the initiate.)

I consider Informix-4GL and the whole embedded SQL concept a major mistake on
the part of Informix Software.  I only hope they see the light before they
feel the flames.
-- 
[Copyright 1987 Brandon S. Allbery, all rights reserved] \ ncoast 216 781 6201
[Redistributable only if redistribution is subsequently permitted.] \ 2400 bd.
Brandon S. Allbery, moderator of comp.sources.misc and comp.binaries.ibm.pc
{{ames,harvard,mit-eddie}!necntc,{well,ihnp4}!hoptoad,cbosgd}!ncoast!allbery
<>