Re: Problems selecting varchar using SDK 2.30UC1
Posted in 1999
Tino Cremidis wrote:
>
> Hello,
>
> I am having strange results when fetching data
> from a varchar column. I guess it is better to
> show the problem rather than try to explain it.
>
> 1) Create a table and populate it with two rows:
>
> Database stores7;
> Create table work1 (
> col1 varchar(10)
> )
OK
> Insert into work1 values ('123456');
> Insert into work1 values ('ABC');
So far, so good. Using what tool? Dbaccess or an ESQL/C program?
> 2) Then, using the demo program provided by
> informix: /usr/informix/demo/esqlc/dyn_sql.ec
Hmmmmmm, here's a posible culprit.
> execute the following select statement,
> SELECT * from WORK1;>
> On my system the output looks something like:
> col1 : 123456
> col2 : ABC456
Uh, huh! And what do you get from executing that select from within
dbaccess or Jonathan's sqlcmd utility? I suspect that there is a bug in
dyn_sql.ec which is fetching the column as ESQL/C type VARCHAR which
strips the trailing spaces and does not NULL terminate and so the
trailing 3 chars from the previous record are being printed out also.
Art S. Kagel
> My environment: AIX 4.3, SDK 2.30 UC1, Online 7.31.UC2A
>
> Any ideas?
>
> Tino