Re: [PDO] Mapping data type/size
[email protected] (goran miskovic) Thu, 29 Oct 2009 20:27:16 +0100
| Newsgroups | php.pdo |
|---|---|
| Message-ID | <[email protected]> |
You are right: http://dev.mysql.com/doc/refman/4.1/en/boolean-values.html Beginning with MySQL 4.1, The constants TRUE and FALSE evaluate to 1 and 0, > respectively. The constant names can be written in any lettercase MySQL Administrator is, when setting column data type, offering BOOLEAN but it will be converted to TINYINT(1) on save. How about using constants TRUE and FALSE? If so, even if mySQL folks, after Oracle acquisition of Sun, decide to introduce BOOLEAN data type they will have to change value of those two constants accordingly and still we will be good. :) Fortunately, when it can be this way or that way, or both ways, or none of those two, or none at all, or there can be a third way, the result is clear: Confusion. :) *The one-L lama, he's a priest* *The two-L llama, he's a beast**And I would bet a silk pyjama* *There isn't any three-L lllama* *Frederic Ogden Nash* Perhaps, as in marketing, defining target group might be helpful: Developers that use char(1) are not in the target group ergo we don't care. ;) Goran On Thu, Oct 29, 2009 at 7:05 PM, Lukas Kahwe Smith <[email protected]>wrote: > > On 29.10.2009, at 17:59, goran miskovic wrote: > > I am using PDO:: PARAM_BOOL although in mySQL it would be 0 or 1 and it >> makes sense to me: Boolean is variable type defined in PHP and as a >> developer I don't care much if there is matching field type in the >> database >> or not. For sure somehow it must be handled. I would expect PDO to know in >> which way particular database is handling boolean values and send correct >> value. >> >> My understanding is that when explicitly defining variable type I am >> saying >> that given variable is of defined PHP type and it is on PDO to handle >> it accordingly to RDBMS in use. >> > > > well the problem is that there is no defined way to handle bools in mysql. > i think they made it an alias tinyint (added in 4.1): > http://dev.mysql.com/doc/refman/4.1/en/numeric-type-overview.html > > but there are still plenty of people that use char(1). > > regards, > > Lukas Kahwe Smith > [email protected] > > > >