Re: -404 on OPEN cursor (stupid Informix!!!!)
Posted in 1997
}From: Daniel Wright <danwright@bigfoot.com> }Date: Mon, 14 Apr 1997 19:07:42 -0500 }X-Informix-List-Id: <news.36567> } }I refined the problem to 2 very small source modules which exhibited the }same behavior. }To re-confirm there was nothing wrong with the EC, I added a main which }called the function w/ the error and compiled it by itself. It ran fine }with no errors. Good. }Then I just happened to compile the old program with c4gl instead of }esql: }c4gl -c bug_ec.ec -o bug_ec.o }c4gl -c bug_4gl.4gl -o bug_4gl.o }c4gl -s bug_ec.o bug_4gl.o -o buggy }(previous compiles had esql -c bug_ec.ec -o bug_ec.o). }SO, I see 2 possible explanations: }1: esql cannot be used for compiling ec modules which are linked into }4GL modules (If this is the case, why did the PREPARE not fail? This is correct -- it's what I mentioned as a possible problem in my previous response. THOU SHALT NOT TRY TO USE ESQL/C VERSION 7.x WITH I4GL 6.0x OBJECT CODE. Because it doesn't work, and it doesn't work in erratic ways. }ALSO if this is the case Informix should have at least given me a compile }time error a la "incompatible object files" or some such BS) The only way it could achieve this is by creating a link error (it can't tell while you're compiling the source code separately that you're going to link it with the wrong stuff). And the only way of creating a link error is to ensure that the new version of ESQL/C is not compatible with any old version of ESQL/C, which is even less acceptable. If this was C++ with type-safe linkage, then you might have found out about the problem at link time; one of the functions used internally (_iqlocate_cursor()) has had a variable call interface (with 2, 3, or 4 arguments at various times, and different overloadings for the second argument at different times). Mixing ESQL/C with I4GL is old news in this forum. The basic rule is: if it is going to be linked with the c4gl script, compile it with the c4gl script. That'll work; other things won't necessarily -- witness your elaborate demonstration of the problem. }2: Informix has a problem. } }Gee, either way I blame Informix. Can anyone justify this behavior? I just did. Whether that's acceptable to you is another matter. Nevertheless, there are reasons why the behaviour is as it is. }First thing I'm going to do at work tomorrow is find which Informix }manual covers this and read it, but I still think it's ridiculous to }have to do so, and I'm not looking forward to trying to find the right }manual (Informix just knows how to write a manual so that no matter }which one you pick up, the answers always in the one left on the shelf.) Maybe; the manuals cover a single version, not mixed versions. If you managed to find a 6.00 ESQL/C compiler (unlikely), then you could compile with it and the 6.0x I4GL and you'd be OK. Mixing versions doesn't work. You should, in any case, have read the release notes -- TOOLREL_6.03 has a section on 'NOTES ON MIXING INFORMIX-4GL/INFORMIX-ISQL WITH ESQL/C'. }Daniel Wright wrote: }> }> This is either something really stupid on my part, or a real problem. }> }> I prepare a select statement }> (SQLCODE == 0) after the prepare }> I Declare a cursor for the prepared statement }> (SQLCODE == 0) after the declare }> I OPEN the cursor I just declared }> SQLCODE == -404 (Cursor not available) }> }> I triple checked that the cursor name I tried to open was the same as }> the one I declared, and did the same for the statement I prepared and }> declared the cursor from. }> }> Any ideas will be most appreciated, }> }> (The cursor appears in an ESQL/C module which is compiled along with a }> 4GL module into an executable - the cursor is in the E/C because that's }> where the variables I intend to use exist; }> I wrote a short EC program to verify that I was preparing, declaring }> and opening properly; }> HP-UX 10; Informix 7.21) Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>