I had designed a MySQL table with one column defined as VarChar(250).
When I asked for some data to test with, I quickly realized that the column needed to be more like 3000 bytes. The Mascon client I often use would let me specify a text column, but not the max size.
Question is - if we add a row that simply has ABC - is this variable length, and am I just storing those three bytes plus whatever is needed to store the length of that field, or am I storing some huge - 2^16 or some such?
A little worried, as I could not specify a max size, but I gather that this is
calculated and taken care of by MySql...
thanks,
Phil J.
Text datatype
Moderator: General Moderators
-
fractalvibes
- Forum Contributor
- Posts: 335
- Joined: Thu Sep 26, 2002 6:14 pm
- Location: Waco, Texas
If you need to have bigger fields you have to use the blob fields. I think thers two diffrent kinds in mysql, binary and text. You probably want to use a text-blob if you just want to store a string. You do not need to specify the size of the blob, I think theres three diffrent type's of binary and text blob. The type determines the max-size.
Check the mysql manual pages for more info.
Check the mysql manual pages for more info.
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
-
fractalvibes
- Forum Contributor
- Posts: 335
- Joined: Thu Sep 26, 2002 6:14 pm
- Location: Waco, Texas
Thanks for the reply, Haagen and Mac. I am used to supplying a maxsize even with BLOB datatypes in DB2, so I was left with an uneasy feeling when MySQL would not allow this...
So I gather that a column defined as Text, in a particular instance I store the string 'ABC' - it actually is storing only 3 bytes plus however many bytes are needed to represent the actual size? i.e. variable length.
thanks,
Phil J.
So I gather that a column defined as Text, in a particular instance I store the string 'ABC' - it actually is storing only 3 bytes plus however many bytes are needed to represent the actual size? i.e. variable length.
thanks,
Phil J.