jmcnally 2002/06/04 14:18:47
Modified: src/java/org/apache/torque/util BasePeer.java
Log:
added support to doPSSelect for NumberKeys and noted the absence of support
for nulls.
removed a bit of duplicated code
added support for modifiers withing functions similar to how it is done in doSelect
Revision Changes Path
1.44 +13 -6
jakarta-turbine-torque/src/java/org/apache/torque/util/BasePeer.java
Index: BasePeer.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/util/BasePeer.java,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- BasePeer.java 2 Jun 2002 15:38:55 -0000 1.43
+++ BasePeer.java 4 Jun 2002 21:18:47 -0000 1.44
@@ -106,7 +106,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Frank Y. Kim</a>
* @author <a href="mailto:[EMAIL PROTECTED]">John D. McNally</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Brett McLaughlin</a>
- * @version $Id: BasePeer.java,v 1.43 2002/06/02 15:38:55 mpoeschl Exp $
+ * @version $Id: BasePeer.java,v 1.44 2002/06/04 21:18:47 jmcnally Exp $
*/
public abstract class BasePeer implements java.io.Serializable
{
@@ -2138,6 +2138,7 @@
/**
* Performs a SQL <code>select</code> using a PreparedStatement.
+ * Note: this method does not handle null criteria values.
*
* @exception TorqueException Error performing database query.
*/
@@ -2163,6 +2164,10 @@
{
stmt.setDate(i + 1, (java.sql.Date) param);
}
+ else if (param instanceof NumberKey)
+ {
+ stmt.setBigDecimal(i+1, ((NumberKey)param).getBigDecimal());
+ }
else
{
stmt.setString(i + 1, param.toString());
@@ -2256,11 +2261,6 @@
selectModifiers.add( modifiers.get(i) );
}
- for (int i = 0; i < modifiers.size(); i++)
- {
- selectModifiers.add( modifiers.get(i) );
- }
-
for (int i = 0; i < select.size(); i++)
{
String columnName = select.get(i);
@@ -2279,6 +2279,13 @@
{
tableName = columnName.substring(parenPos + 1,
columnName.indexOf('.') );
+ // functions may contain qualifiers so only take the last
+ // word as the table name.
+ int lastSpace = tableName.lastIndexOf(' ');
+ if ( lastSpace != -1 )
+ {
+ tableName = tableName.substring(lastSpace + 1);
+ }
}
String tableName2 = criteria.getTableForAlias(tableName);
if ( tableName2 != null )
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>