You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by an...@di.uoa.gr on 2006/02/19 15:53:25 UTC

Bit columns in Mysql 5

Hello,

  a couple of months ago, we had discussed the problem in mysql 5 with the bit
type (the jdbc driver incorrectly reported the type as String). A couple of bug
fixes were submitted and one of them was included in the new beta version of
connector/j 5.0 (http://dev.mysql.com/downloads/connector/j/5.0.html).
  I tried the new version, but the exact same problem persisted (exception when
inserting new boolean values and always returning false for bit values already
in database)...
  I searched the source code of torque and village and came up with a
torque-specific solution (actually a village-specific):

  in file com\workingdogs\village\Column.java add the following lines in line 178:

   if (this.columnTypeName.toLowerCase().equals("bit"))
       this.columnType = Types.BIT;

  in file com\workingdogs\village\Value.java replace the lines 1573-1574 with
the following:

        return (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("t") ||
value.equalsIgnoreCase("yes") || value.equalsIgnoreCase("y") ||
value.equals("1") || value.charAt(0) == 1);

I don't know if it's generic enough, but it works for me ;)

Antonis.

PS. I am reffering to village version 2.0 used in torque 3.2
(http://www.softwareforge.de/releases/village/distributions/) 


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org