tfischer 2005/05/08 08:56:49
Modified: src/java/org/apache/torque/adapter DBPostgres.java
xdocs changes.xml
src/test/org/apache/torque/util CriteriaTest.java
Log:
Changed the handling of BIT columns in Postgres to use TRUE,FALSE instead of
'1','0'.
The Postgresql Manual says for Boolean columns (BIT is mapped to Boolean in
Postgres):
PostgreSQL provides the standard SQL type boolean. boolean can have one of
only two states: "true" or "false". A third state, "unknown", is represented by
the SQL null value.
Valid literal values for the "true" state are:
TRUE
't'
'true'
'y'
'yes'
'1'
For the "false" state, the following values can be used:
FALSE
'f'
'false'
'n'
'no'
'0'
Using the key words TRUE and FALSE is preferred (and SQL-compliant).
Thanks to Tarlika Elisabeth Schmitz for pointing this out.
PR: TRQS221
Revision Changes Path
1.19 +2 -2
db-torque/src/java/org/apache/torque/adapter/DBPostgres.java
Index: DBPostgres.java
===================================================================
RCS file:
/home/cvs/db-torque/src/java/org/apache/torque/adapter/DBPostgres.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- DBPostgres.java 31 Jan 2005 19:43:55 -0000 1.18
+++ DBPostgres.java 8 May 2005 15:56:49 -0000 1.19
@@ -152,7 +152,7 @@
*/
public String getBooleanString(Boolean b)
{
- return (b == null) ? "0" : (Boolean.TRUE.equals(b) ? "1" : "0");
+ return (b == null) ? "FALSE" : (Boolean.TRUE.equals(b) ? "TRUE" :
"FALSE");
}
/**
1.155 +4 -0 db-torque/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/db-torque/xdocs/changes.xml,v
retrieving revision 1.154
retrieving revision 1.155
diff -u -r1.154 -r1.155
--- changes.xml 23 Apr 2005 18:43:40 -0000 1.154
+++ changes.xml 8 May 2005 15:56:49 -0000 1.155
@@ -28,6 +28,10 @@
<body>
<release version="3.2-dev" date="in CVS">
+ <action type="update" dev="tfischer" issue="TRQS221">
+ Changed Postgres handling of boolean Values to use FALSE,TRUE instead
of '0','1'
+ while selecting from columns of Torque type BIT
+ </action>
<action type="add" dev="tfischer" issue="TRQS251">
Added support for using SQL functions in "order by"
</action>
1.24 +2 -2
db-torque/src/test/org/apache/torque/util/CriteriaTest.java
Index: CriteriaTest.java
===================================================================
RCS file:
/home/cvs/db-torque/src/test/org/apache/torque/util/CriteriaTest.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- CriteriaTest.java 31 Jan 2005 19:43:54 -0000 1.23
+++ CriteriaTest.java 8 May 2005 15:56:49 -0000 1.24
@@ -275,7 +275,7 @@
fail("Exception thrown in DBFactory");
}
- assertEquals("TABLE.COLUMN=1", cc.toString());
+ assertEquals("TABLE.COLUMN=TRUE", cc.toString());
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]