|
I’m trying to figure out the best approach to handle tinyint Booleans in MySQL 5.0.22...
Since Bool/Boolean is converted to TinyInt(1) in MySQL Reactor creates logic that works with numeric rather than boolean. For instance the validators check isNumeric() which results in all my true/false fields erring out.
To get Reactor to compile Boolean validators I have changed the data.mysql.ObjectDAO to also pull out the additional COLUMN_TYPE metadata. When reactor calls getCFDataType I send it the COLUMN_TYPE as an argument. With the modified case below I can then suss out the tinyint(1)’s to be returned as Boolean.
<!--- mysql converts boolean, bool to tinyint ---> <cfcase value="tinyint"> <cfif arguments.columnType EQ "tinyint(1)"> <cfreturn "boolean" /> <cfelse> <cfreturn "numeric" /> </cfif> </cfcase>
Now I know there is the possibility of non Boolean tinyint(1) columns in the database but on my first check of our tables it looks like this has only been used for Booleans. Lucky.
Anyone think of other cleaner ways to handle this?
Cheers Angus
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Reactor for ColdFusion Mailing List [email protected] Archives at: http://www.mail-archive.com/reactor%40doughughes.net/ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
- [Reactor for CF] MySQL boolean/tinyint conversions ajohnson
- RE: [Reactor for CF] MySQL boolean/tinyint conversion... Chris Blackwell
