Amount of data stored in a blob

2005-01-13 Thread Mads Kristensen
Is it true that I can only store 65535 bytes (2^16-1) in a field of type 
BLOB? I thought that a BLOB was supposed to be able to hold 2^16 bytes 
of data.

If it is indeed only possible to store 2^16-1 bytes I would like to know 
why this has been implemented in that way (yes, I am always this curious ;-)

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


Re: Amount of data stored in a blob

2005-01-13 Thread Duncan Hill
On Thursday 13 January 2005 12:42, Mads Kristensen might have typed:

 If it is indeed only possible to store 2^16-1 bytes I would like to know
 why this has been implemented in that way (yes, I am always this curious
 ;-)

http://dev.mysql.com/doc/mysql/en/String_type_overview.html

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



Re: Amount of data stored in a blob

2005-01-13 Thread Mads Kristensen
Ok. I am replying to my own post here ;-)
I guess that the reason is the fact that only 2 bytes are reserved for
storing the size of the BLOB, and since an unsigned short's maximum
value is 2^16-1 this is also the maximum size of the BLOB.
So, mystery solved :-)
 - Mads
Mads Kristensen wrote:
Is it true that I can only store 65535 bytes (2^16-1) in a field of type 
BLOB? I thought that a BLOB was supposed to be able to hold 2^16 bytes 
of data.

If it is indeed only possible to store 2^16-1 bytes I would like to know 
why this has been implemented in that way (yes, I am always this curious 
;-)

Best regards,
Mads Kristensen

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


Re: Amount of data stored in a blob

2005-01-13 Thread Alec . Cawley
Mads Kristensen [EMAIL PROTECTED] wrote on 13/01/2005 12:42:13:

 Is it true that I can only store 65535 bytes (2^16-1) in a field of type 

 BLOB? I thought that a BLOB was supposed to be able to hold 2^16 bytes 
 of data.
 
 If it is indeed only possible to store 2^16-1 bytes I would like to know 

 why this has been implemented in that way (yes, I am always this curious 
;-)

The BLOB has to have a length, which is stored in 16 bits, range 0-65535. 
The concept of a zero length blob, as distinct from a NULL record, is 
perfectly valid, and may in some contexts be meaningful. Also, it avoids 
special logic for mapping the 65538 case to zero and erroring the zero 
case. If you want 65536, go for a MEDIUMBLOB: the overhead is only one 
part in 60,000.

Alec


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