Gleb Paharenko wrote:
In my opinion, one of the causes of the problem can be the processing
of trailing spaces in varbinary fields. See:
http://dev.mysql.com/doc/mysql/en/binary-varbinary.html
"William R. Mussatto" <[EMAIL PROTECTED]> wrote:
I was storing some 8 bit information in a varchar binary field (encrypted
stuff) and I think its getting corrupted. I thought they were (except for
size) interchangable? I'm running debian GNU Linux and haven't moved to
sarge so I'm still on 3.23.x but will be moving shortly.
As I understand it:
- CHAR, VARCHAR, BINARY and VARBINARY store strings (character or binary
strings that is) and trailing spaces are removed
- the BINARY *attribute* for e.g. VARCHAR columns signals that the
binary collation is to be used for sorting, comparing, etc. Without the
BINARY attribute accented letters can be considered equal to their
non-accented counterparts if the collation says so (which might be handy
for searching, etc.).
- BLOB and TEXT types (with their variations) can store 'large' amounts
of data. In most cases the actual data (or part of it in case of the NDB
engine) is not stored in the table itself, but in a different location.
I tend to think of it as if a pointer is stored in the table which
points to the location of the data itself. BLOB type columns use the
binary collation, TEXT type columns use a character collation.
If you use for example AES_ENCRYPT() to store encrypted data you should
use some kind of BLOB field to store the data.
http://dev.mysql.com/doc/mysql/en/encryption-functions.html also warns
for this at the top of the page:
"The functions in this section encrypt and decrypt data values. If you
want to store results from an encryption function that might contain
arbitrary byte values, use a BLOB column rather than a CHAR or VARCHAR
column to avoid potential problems with trailing space removal that
would change data values"
Regards, Jigal.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]