On 01/06/12 12:56, Manikantan, Madhunapanthula_Naaga wrote:
Forwarding to DBI-dev , DBI-users as an fyi.
Thanks

Please don't forward this kind of post to dbi-dev as it is not really a DBI 
development issue.

_____________________________________________
From: Manikantan, Madhunapanthula_Naaga
Sent: Friday, June 01, 2012 5:02 PM
To: 'Martin J. Evans'
Subject: DBD::ODBC {ChopBlanks=>1} option issue


Hello Martin,

I hope you are doing well.

ChopBlanks option, doesn't seem to work with DBD::ODBC.  Can you please help?

I checked out latest version of DBD::ODBC from svn.perl.org and tested the 
below script on solaris and Linux.

Please let me know if you need further information.

O/p from my test
----
manik...@finop2.nyc:~/Driver$<mailto:manik...@finop2.nyc:~/Driver$>  perl  -I 
blib/lib/ -I blib/arch/  ~/chopblanks.pl
$VAR1 = [
           [
             ' ' # has once space
           ]
         ];

SQL
---
# Create table
create table test (v varchar(128))
# set permissions
grant all on public to test
# populate data
insert into test values('  ') -- one space

From the DBI documentation:

The "ChopBlanks" attribute can be used to control the trimming of trailing 
space characters from fixed
       width character (CHAR) fields. No other field types are affected, even 
where field values have trailing
       spaces.

Your column is not fixed width - it is VARCHAR.

DBD::ODBC only does ChopBlanks on columns of type SQL_CHAR and SQL_WCHAR.

<snipped example>

Martin
--
Martin J. Evans
Easysoft Limited
http://www.easysoft.com

Reply via email to