Up Prev Next
From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: Does DBD::Sybase strip spaces from padded VARCHARs?
Date: Apr 12 2004 2:53PM
On Sun, 2004-04-11 at 19:27, firstname.lastname@example.org wrote:
> On Sat, Apr 10, 2004 at 09:44:04PM -0700, Michael Peppler wrote:
> > On Sat, 2004-04-10 at 18:17, email@example.com wrote:
> > > I'm using DBD::Sybase 1.02 and DBI 1.42.
> > >
> > > The stored procedure writer here is telling me that she's sending
> > > a VARCHAR that's padded with spaces, but the spaces aren't there
> > > when I retrieve them with fetchrow_arrayref.
> > See my answer in dbi-users - varchar() values are always truncated of
> > any trailing whitespace when they are inserted to a table.
> Just to be clear, we're not trying to store a space-padded VARCHAR.
> We're trying to fetch a result set generated by a stored procedure
> in which the VARCHAR columns are padded using convert(). The script
> expects the result set from the stored proc to include the padding,
> but the padding isn't included in the columns of the arrayref.
What sort of convert() are you doing?
If you need the trailing white space you should be doing a
which will pad your string to xxx chars.
> In the stored procedure, they've checked the length of the space-padded
> VARCHAR after doing the convert(), and the spaces are there. (All columns
> are padded to the same length.) Do you know whether Open Client chomps
> the spaces while returning the result set?
If the spaces are there on the wire (i.e. get sent from the server) then
the spaces won't get truncated. Could you ask your SQL developers to
produce a small example of what they think should work?
I'd like to see how they are doing this...
Michael Peppler Data Migrations, Inc.
Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short or
long term contract positions - http://www.peppler.org/resume.html