Re: Re: novice: char to varchar

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



My guess is that the solution is that MySql, though it supports the syntax 
for standard SQL and thus takes char and varchar, it actually doesn't have a 
specific storage type for each, all chars are stored in varchar fields, just 
as all boolean or bit fields are stored in integer fields.

Though this would be a quite acceptable optimization on the part of the SQL 
engine, the problem is that it reports what the optimization did, not what 
you asked for.  I mean, if I ask for char, report to me a char, no matter 
what is it that you stored it in.

I actually reported this as a 'feature request' in the MySql site: 
http://bugs.mysql.com/bug.php?id=3350.  I first discovered it when I 
migrated a 'form creator' which I made years ago and is already in its third 
incarnation of language/database, which makes forms based on the structure 
of a database table.  Depending on the field type it creates an appropriate 
input field with validation, normal input for char or varchar fields, 
textareas if the field length is longer than a configurable size, calendar 
controls for dates, <select> listboxes if you indicate a lookup table and, 
checkboxes if the field is boolean.  The problem is that MySql does not 
report booleans as such but as the storage type, which might be different 
from the declared type, so I didn't get my checkboxes.  So I am forced to 
explicitly declare to the form creator which fields are actually boolean 
since it cannot pick it from the database structure.

Satyam







"Kim Madsen" <km@xxxxxxx> wrote in message 
news:15653CE98281AD4FBD7F70BCEE3666E5313938@xxxxxxxxxxxxxxxxxxxxxxxx
> -----Original Message-----
> From: tony yau [mailto:tony.yau@xxxxxxxxxxxx]
> Sent: Wednesday, May 18, 2005 9:03 PM

> found the answer sorry about this

But You don´t wanna share the solution with the rest of the class?

--
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen
Systemudvikler/Systemdeveloper 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux