RE: [PEAR] regarding VARCHAR and CHAR
| From: | Lukas Smith | Date: | Wed, 16 Oct 2002 20:08:57 +0000 |
| Subject: | RE: [PEAR] regarding VARCHAR and CHAR | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-2510@lists.php.net to get a copy of this message | ||
> From: Jason Lotito [mailto:jason@clockmedia.com]
> Sent: Wednesday, October 16, 2002 10:05 PM
>
> > > > > From: Jason Lotito [mailto:jason@clockmedia.com]
> > > > > Sent: Wednesday, October 16, 2002 3:30 PM
> > > > > To: smith@dybnet.de
> > > > > Subject: RE: [PEAR] regarding VARCHAR and CHAR
> > > > >
> > > > > Actually, not really. The use of VARCHAR and CHAR in MySQL is
> > > > strictly
> > > > > defined, and quite easy to understand.
> > > > >
> > > > > If an entire table is fixed width, then MySQL will use CHAR
> > > > unless you
> > > > > tell it to use VARCHAR.
> > > >
> > > > Well that is what I thought, but reading the text in the Url I
> > > > provided that is appreantly wrong.
> > > >
> > >
> > > No, it's just as I say it is:
> > >
> > > "If any column in a table has a variable length, the entire row is
> > > variable-length as a result. Therefore, if a table contains any
> > > variable-length columns (VARCHAR, TEXT, or BLOB), all CHAR columns
> > > longer than three characters are changed to VARCHAR columns. This
> > > doesn't affect how you use the columns in any way; in MySQL,
VARCHAR
> > is
> > > just a different way to store characters. MySQL performs this
> > conversion
> > > because it saves space and makes table operations faster."
> > >
> >
> > So the MySQL manual is incorrect on this?
> > http://www.mysql.com/doc/en/CHAR.html
> >
> http://www.mysql.com/doc/en/Silent_column_changes.html
>
> Again what you are saying is what I always thought as well
>
>
> I quoted the MySQL manual (see the above quote starting "If any
> column..." and on this page, the second list item
> [http://www.mysql.com/doc/en/Silent_column_changes.html]). It clearly
> spells out what I was saying.
Ah ok misunderstanding on my part.
Basically the issue that raised this question that I wanted to answer
was if it makes sense to use VARCHAR as the datatype for MDB's internal
Text datatype or CHAR as it is now. And it seems like staying with CHAR
is the way to go since MySQL will handle switching to VARCHAR were it
makes sense.
Regards,
Lukas