seade 2004/08/23 04:49:04
Modified: src/generator/src/templates/om Tag: TORQUE_3_1_BRANCH
Peer.vm
src/generator/src/java/org/apache/torque/engine/database/model
Tag: TORQUE_3_1_BRANCH TypeMap.java Column.java
xdocs Tag: TORQUE_3_1_BRANCH release-changes.xml
Log:
Corrected handling of BIT with PostgreSQL. Note that the solution implemented has been
tested under MySLQ and PostgreSQL only.
Revision Changes Path
No revision
No revision
1.5.2.4 +102 -0 db-torque/src/generator/src/templates/om/Peer.vm
Index: Peer.vm
===================================================================
RCS file: /home/cvs/db-torque/src/generator/src/templates/om/Peer.vm,v
retrieving revision 1.5.2.3
retrieving revision 1.5.2.4
diff -u -r1.5.2.3 -r1.5.2.4
--- Peer.vm 6 Apr 2004 12:49:46 -0000 1.5.2.3
+++ Peer.vm 23 Aug 2004 11:49:04 -0000 1.5.2.4
@@ -282,6 +282,23 @@
}
}
}
+ #elseif ($col.isBit())
+ // check for conversion from boolean to bit (1/0)
+ if (criteria.containsKey($cup))
+ {
+ Object possibleBoolean = criteria.get($cup);
+ if (possibleBoolean instanceof Boolean)
+ {
+ if (((Boolean) possibleBoolean).booleanValue())
+ {
+ criteria.add($cup, "1");
+ }
+ else
+ {
+ criteria.add($cup, "0");
+ }
+ }
+ }
#end
#end
@@ -478,6 +495,23 @@
}
}
}
+ #elseif ($col.isBit())
+ // check for conversion from boolean to bit (1/0)
+ if (criteria.containsKey($cup))
+ {
+ Object possibleBoolean = criteria.get($cup);
+ if (possibleBoolean instanceof Boolean)
+ {
+ if (((Boolean) possibleBoolean).booleanValue())
+ {
+ criteria.add($cup, "1");
+ }
+ else
+ {
+ criteria.add($cup, "0");
+ }
+ }
+ }
#end
#end
@@ -666,6 +700,23 @@
}
}
}
+ #elseif ($col.isBit())
+ // check for conversion from boolean to bit (1/0)
+ if (criteria.containsKey($cup))
+ {
+ Object possibleBoolean = criteria.get($cup);
+ if (possibleBoolean instanceof Boolean)
+ {
+ if (((Boolean) possibleBoolean).booleanValue())
+ {
+ criteria.add($cup, "1");
+ }
+ else
+ {
+ criteria.add($cup, "0");
+ }
+ }
+ }
#end
#if($col.isPrimaryKey())
selectCriteria.put($cup, criteria.remove($cup));
@@ -751,6 +802,23 @@
}
}
}
+ #elseif ($col.isBit())
+ // check for conversion from boolean to bit (1/0)
+ if (criteria.containsKey($cup))
+ {
+ Object possibleBoolean = criteria.get($cup);
+ if (possibleBoolean instanceof Boolean)
+ {
+ if (((Boolean) possibleBoolean).booleanValue())
+ {
+ criteria.add($cup, "1");
+ }
+ else
+ {
+ criteria.add($cup, "0");
+ }
+ }
+ }
#end
#end
@@ -1290,6 +1358,23 @@
}
}
}
+ #elseif ($col.isBit())
+ // check for conversion from boolean to bit (1/0)
+ if (c.containsKey($cup))
+ {
+ Object possibleBoolean = c.get($cup);
+ if (possibleBoolean instanceof Boolean)
+ {
+ if (((Boolean) possibleBoolean).booleanValue())
+ {
+ c.add($cup, "1");
+ }
+ else
+ {
+ c.add($cup, "0");
+ }
+ }
+ }
#end
#end
@@ -1457,6 +1542,23 @@
else
{
c.add($cup, "N");
+ }
+ }
+ }
+ #elseif ($col.isBit())
+ // check for conversion from boolean to bit (1/0)
+ if (c.containsKey($cup))
+ {
+ Object possibleBoolean = c.get($cup);
+ if (possibleBoolean instanceof Boolean)
+ {
+ if (((Boolean) possibleBoolean).booleanValue())
+ {
+ c.add($cup, "1");
+ }
+ else
+ {
+ c.add($cup, "0");
}
}
}
No revision
No revision
1.2.2.3 +13 -1 db-torque/src/generator/src/java/org/apache/torque/engine/database/model/TypeMap.java
Index: TypeMap.java
===================================================================
RCS file: /home/cvs/db-torque/src/generator/src/java/org/apache/torque/engine/database/model/TypeMap.java,v
retrieving revision 1.2.2.2
retrieving revision 1.2.2.3
diff -u -r1.2.2.2 -r1.2.2.3
--- TypeMap.java 20 May 2004 04:34:15 -0000 1.2.2.2
+++ TypeMap.java 23 Aug 2004 11:49:04 -0000 1.2.2.3
@@ -625,6 +625,18 @@
}
/**
+ * Returns true if the type is boolean in the
+ * java object and a Bit "1" or "0" in the db.
+ *
+ * @param type The type to check.
+ * @return true if the type is BIT
+ */
+ public static boolean isBit(String type)
+ {
+ return BIT.equals(type);
+ }
+
+ /**
* Returns true if values for the type need to be quoted.
*
* @param type The type to check.
1.5.2.4 +10 -1 db-torque/src/generator/src/java/org/apache/torque/engine/database/model/Column.java
Index: Column.java
===================================================================
RCS file: /home/cvs/db-torque/src/generator/src/java/org/apache/torque/engine/database/model/Column.java,v
retrieving revision 1.5.2.3
retrieving revision 1.5.2.4
diff -u -r1.5.2.3 -r1.5.2.4
--- Column.java 20 May 2004 04:34:15 -0000 1.5.2.3
+++ Column.java 23 Aug 2004 11:49:04 -0000 1.5.2.4
@@ -845,6 +845,15 @@
}
/**
+ * Returns true if the column type is boolean in the
+ * java object and a Bit ("1" or "0") in the db.
+ */
+ public boolean isBit()
+ {
+ return TypeMap.isBit(torqueType);
+ }
+
+ /**
* returns true, if the columns java native type is an
* boolean, byte, short, int, long, float, double, char
*/
No revision
No revision
1.3.2.15 +4 -0 db-torque/xdocs/release-changes.xml
Index: release-changes.xml
===================================================================
RCS file: /home/cvs/db-torque/xdocs/release-changes.xml,v
retrieving revision 1.3.2.14
retrieving revision 1.3.2.15
diff -u -r1.3.2.14 -r1.3.2.15
--- release-changes.xml 23 Aug 2004 02:54:15 -0000 1.3.2.14
+++ release-changes.xml 23 Aug 2004 11:49:04 -0000 1.3.2.15
@@ -43,6 +43,10 @@
<p>
<ul>
<li>
+ Corrected handling of BIT with PostgreSQL. Note that the solution
+ implemented has been tested under MySLQ and PostgreSQL only.
+ </li>
+ <li>
Multiple unique constraints and indexes on a single table are now
allocated sequential names (previously duplicate names were being
allocated).
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org
|