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, second version of the patch, based on feedback from Darren and Dave.

Without any further settings, the Producer::MySQL will output the same SQL as before, using ENUM('0', '1') to replace the BOOLEAN fields.

If you add a `server_version` producer argument, the boolean will be transformed:

 * for server_version < 4.1, we will use 'tinyint';
 * for server_version >= 4.1, we will use 'boolean'.

Tests, and documentation also updated.

Attachment: mysql_producer_boolean.patch
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