Dropping Trailing Whitespace

Dropping Trailing Whitespace

am 17.03.2003 15:40:10 von Gabriel Weinberg

------=_NextPart_000_00DF_01C2EC69.33C7AB80
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit

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@alum.mit.edu


------=_NextPart_000_00DF_01C2EC69.33C7AB80
Content-Type: text/plain; charset=us-ascii

------------------------------------------------------------ ---------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread2082@lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.
------=_NextPart_000_00DF_01C2EC69.33C7AB80--