Re: Problem with ESQL/C 7.20
Posted in 1997
}From: dirk.scheer@stadt-mh.de (Dirk Scheer) }Date: Tue, 04 Feb 97 17:27:05 GMT }X-Informix-List-Id: <news.33431> } }Hello out there, } }I've written a short ESQL-program which shows me the datatype of a }aggregate function in a SELECT statement. This program is working well with a }INFORMIX5 db as backend, but if I access a INFORMIX7 db I get an incorrect }datatype. But it is important for me to get the correct datatype. I've }included the source: } }[...I've omitted the source code...] } }With a INFORMIX5 backend I'll get the correct values: } Type = 2 (ID for an integer field) } # of rows = 26 } }With a INFORMIX7 backend I'll get incorrect values: } Type = 5 (ID for a decimal field) } # of rows = 0 } }My configuration: } WIN95 } INFORMIX ESQL/C 7.20.TE1 } MSVC 4.2 } }Does anybody have a conclusion for this behaviour. Any hints are appreciated! The datatype is not incorrect; it is just different. Since it is possible to have more than 2**31-1 rows in a 7.2x OnLine table, COUNT(*) can return a number which is too large to fit into an INTEGER. To protect against this possibility, the engine now uses a DECIMAL type for COUNT (and most numeric aggregates). You can decide to retrieve the value into an integer anyway, as your code does. I ran the code on Solaris 2.5.1 with ESQL/C 7.21.UC1, adding EXEC SQL WHENEVER ERROR STOP to ensure that no errors were going undetected, and changing the database name to 'stores' and the SELECT to "select count(*) from 'informix'.systables", and I got the result: Type = 5 # of rows: 34 Was there any data in your test table with the version 7 engine? Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>