Posted on 2008-10-01 19:34:04-07 by fmr
Null terminated CHARs in results
Hi,

DBD::ODBC version 1.17
DBI version 1.40
OS: RHEL4
Perl: 5.8
DBMS and ODBC driver: Sybase IQ 12.7
The problem is that all CHARs and DATEs in fetchrow_array results have \0 at the end, overwriting the last character of the column. eg a column which should have 'abc' has ab\0 instead.

DBI->trace(4) shows the type for all these columns is unknown (0).

Does anyone have any ideas?

Thanks in advance
Regards
Direct Responses: 8910 | Write a response
Posted on 2008-10-02 07:22:18-07 by mjevans in response to 8906
Re: Null terminated CHARs in results
Does make test for DBD::ODBC complete successfully? Could you produce the smallest script you can to demonstrate the problem e.g., a simple select on the a char and date column followed by a fetch. Then append to the top of the script:
use DBD::ODBC; DBI->trace(DBD::ODBC->parse_trace_flags('odbcconnection|odbcunicode'));
and run it with DBI_TRACE set to 15 and mail me the output. e.g.,
DBI_TRACE=15 perl your_test_script.pl
send me the script and output. Also could you tell me what the actual column types are in your Sybase schema. Also run the following (substituting for DSN, username and password) and send the output:
perl -MDBI -e '$h = DBI->connect("dbi:ODBC:MYDSN","USER","PASS");$x = $h->type_info_all;use Data::D +umper;print Dumper($x);'
Martin
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.