Hi,

On Jan 5, 2008, at 4:05 PM, Ash Berlin wrote:
On Jan 5, 2008, at 11:01 AM, Jess Robinson wrote:
On Sat, 5 Jan 2008, Pedro Melo wrote:
I was using Producer::MySQL and noticed that my boolean fields where
getting generated as ENUM's.

Is there any reason for this? MySQL supports BOOLEAN (converts to
TINYINT).

Ah, but since when has it supported Booleans? SQL::T has been around since at least mysql 3.x, so it contains some rather old assumptions about data
types etc.

[[ These types are synonyms for TINYINT(1). The synonym BOOLEAN was added in MySQL 4.1.0. A value of zero is considered false. Non-zero values are considered true ]]

There you go. So i guess some producer option to switch it back to either enum mode or to an explicity TINYINT(1) for <= v4.0.x would also be in order.

Attached my first attempt at a patch. I don't know if I'm breaking any project rules, if you want some tweaks, ask away.

I'm created a producer_args key, server_version, that you can set to 3.23, or 4.0, or any other version of MySQL. This influences the field type that we generate for boolean fields.

Pre-4.1, MySQL producer will generate a tinyint. 4.1 and above we will generate a boolean. if no version is given, we generate boolean.

Attachment: boolean_mysql_producer.diff
Description: Binary data



Best regards,
--
Pedro Melo
Blog: http://www.simplicidade.org/notes/
XMPP ID: [EMAIL PROTECTED]
Use XMPP!


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
-- 
sqlfairy-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlfairy-developers

Reply via email to