List:MySQL and Perl« Previous MessageNext Message »
From:Gabriel Weinberg Date:March 17 2003 2:40pm
Subject:Dropping Trailing Whitespace
View as plain text  
I am using DBD::mysql w/ perl v5.8.0 on a system running FreeBSD
5.0-RELEASE #0 and mysql  Ver 11.18 Distrib 3.23.55, for
portbld-freebsd5.0 (i386).


I have a table with a column defined as the following.

 hash CHAR(16) BINARY NOT NULL


I am inserting binary md5 hashes into this column using the Digest::MD5
module.


Most data works fine.  However, if the hash has a trailing white space
(ascii character 32), it seems to be getting truncated on the way to
MySQL, such that subsequent queries to find the hash fail.  Of course,
if I do the truncation myself, everything works fine, but the character
really does matter.


I am inserting and comparing via binding the values.

I prepare the queries, and pass the binary hash to the query via the
execute function.


Any ideas?


Attached is an example script that illustrates the problem.


Thank you,

Gabriel

_________________
Gabriel Weinberg
yegg@stripped

Thread
Dropping Trailing WhitespaceGabriel Weinberg17 Mar
  • Re: Dropping Trailing WhitespaceJochen Wiedmann17 Mar
    • RE: Dropping Trailing WhitespaceGabriel Weinberg17 Mar
  • Re: Dropping Trailing WhitespaceJochen Wiedmann19 Mar
    • RE: Dropping Trailing WhitespaceGabriel Weinberg20 Mar
RE: Dropping Trailing WhitespaceJochen Wiedmann20 Mar