On 11 Sep 2003 at 11:04, Andrew Kuebler wrote:

> Are BLOB column types the only columns that will let you write a NULL
> (Hexidecimal 0) and still write beyond that? CHAR, CHAR BINARY,
> VARCHAR, and VARCHAR BINARY all seem to truncate the string and stop
> at the first null even if I escape the string being updated.

Are you sure it's not your application, rather than MySQL, that's 
truncating the string.  If you select LENGTH(column_name), do you get 
the full length of the untruncated string?  I've just tried it with a 
VARCHAR and had no problems.  If I insert 'abc\0def', the length is 
7, and RIGHT(column_name, 3) is 'def'.  It's true that the characters 
after the 0 byte don't show up in the mysql client, but that's not 
the way I'd actually be using them anyway.  What are you using?  C?

Also, how are you inserting the strings?  Are you writing the binary 
0 as '\0'?  (It's confusing to call the character 'NULL' on a list 
about databases, since here people expect NULL to mean something 
completely different.)

> I don't want to use a BLOB column because I'm only writing 8
> characters. extreme waste of space.

Not an extreme waste of space.  If you use TINYBLOB, it's only 1 
extra byte to store the length, so you'll be using 9 bytes instead of 
8.  Still, it doesn't seem like the best idea.

-- 
Keith C. Ivey <[EMAIL PROTECTED]>
Tobacco Documents Online
http://tobaccodocuments.org


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to