|
|
sybperl-l Archive
Up Prev Next
From: Victor Cheng <cheng82 at ibm dot net>
Subject: On NT 4.0/MS SQL Server, CTlib::ct_sql appends an extra \0 to char
and varchar columns
Date: Dec 11 1997 11:43PM
It looks like that for NT 4/MS SQL server CTlib::ct_sql() will append an
extra \0 character to the query result of every char or varchar column,
and this \0 character is included as part of the scalar value. Does
anyone know if MS SQL server is the source of problem or if this is a
compatibility issue in the NT Sybperl port?
I ran debugger to examine the result of a ct_sql call that retrieves a
single column value:
> p length ${$res[0]}[0]
7
> p ord(substr(${$res[0]}[0],6))
0
> print "${$res[0]}[0]XYZ"
US456 XYZ # ${$res[0]}[0] eq "US456\0"
# Note the space before XYZ
I also check the value in the database with isql:
> select ascii(reverse(column)) from table where ...
> go
------
54 # 54 is the ascii code of "6"
Thanks,
Victor
|