cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r564988 - in /cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src: main/java/org/apache/cayenne/access/jdbc/ main/java/org/apache/cayenne/ejbql/ main/java/org/apache/cayenne/ejbql/parser/ test/java/org/apache/cayenne/access/ test/ja...
Date Sun, 12 Aug 2007 00:32:09 GMT
Author: aadamchik
Date: Sat Aug 11 17:32:07 2007
New Revision: 564988

URL: http://svn.apache.org/viewvc?view=rev&rev=564988
Log:
CAY-846 EJBQL Support for Functional Expressions

Added:
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLTrimSpecification.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLFunctionalExpressions.java
Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLConditionTranslator.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/EJBQLBaseVisitor.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/EJBQLExpressionVisitor.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLAbs.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLConcat.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLLength.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLLocate.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLLower.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLMod.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLSqrt.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLSubstring.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLTrim.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLTrimBoth.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLTrimLeading.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLTrimTrailing.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLUpper.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/testdo/inherit/auto/_Department.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/resources/people.map.xml

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLConditionTranslator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLConditionTranslator.java?view=diff&rev=564988&r1=564987&r2=564988
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLConditionTranslator.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLConditionTranslator.java
Sat Aug 11 17:32:07 2007
@@ -31,6 +31,8 @@
 import org.apache.cayenne.ejbql.EJBQLExpression;
 import org.apache.cayenne.ejbql.parser.EJBQLPositionalInputParameter;
 import org.apache.cayenne.ejbql.parser.EJBQLSubselect;
+import org.apache.cayenne.ejbql.parser.EJBQLTrimBoth;
+import org.apache.cayenne.ejbql.parser.EJBQLTrimSpecification;
 
 /**
  * @since 3.0
@@ -466,5 +468,171 @@
             // expression to provide a meaningful type.
             context.append(" #bind($").append(boundName).append(" 'VARCHAR')");
         }
+    }
+
+    public boolean visitCurrentDate(EJBQLExpression expression) {
+        context.append(" {fn CURDATE()}");
+        return false;
+    }
+
+    public boolean visitCurrentTime(EJBQLExpression expression) {
+        context.append(" {fn CURTIME()}");
+        return false;
+    }
+
+    public boolean visitCurrentTimestamp(EJBQLExpression expression) {
+        context.append(" {fn NOW()}");
+        return false;
+    }
+
+    public boolean visitAbs(EJBQLExpression expression, int finishedChildIndex) {
+        if (finishedChildIndex < 0) {
+            context.append(" {fn ABS(");
+        }
+        else if (finishedChildIndex + 1 == expression.getChildrenCount()) {
+            context.append(")}");
+        }
+
+        return true;
+    }
+
+    public boolean visitSqrt(EJBQLExpression expression, int finishedChildIndex) {
+        if (finishedChildIndex < 0) {
+            context.append(" {fn SQRT(");
+        }
+        else if (finishedChildIndex + 1 == expression.getChildrenCount()) {
+            context.append(")}");
+        }
+
+        return true;
+    }
+
+    public boolean visitMod(EJBQLExpression expression, int finishedChildIndex) {
+        if (finishedChildIndex < 0) {
+            context.append(" {fn MOD(");
+        }
+        else if (finishedChildIndex + 1 == expression.getChildrenCount()) {
+            context.append(")}");
+        }
+        else {
+            context.append(',');
+        }
+
+        return true;
+    }
+
+    public boolean visitConcat(EJBQLExpression expression, int finishedChildIndex) {
+        if (finishedChildIndex < 0) {
+            context.append(" {fn CONCAT(");
+        }
+        else if (finishedChildIndex + 1 == expression.getChildrenCount()) {
+            context.append(")}");
+        }
+        else {
+            context.append(',');
+        }
+
+        return true;
+    }
+
+    public boolean visitSubstring(EJBQLExpression expression, int finishedChildIndex) {
+        if (finishedChildIndex < 0) {
+            context.append(" {fn SUBSTRING(");
+        }
+        else if (finishedChildIndex + 1 == expression.getChildrenCount()) {
+            context.append(")}");
+        }
+        else {
+            context.append(',');
+        }
+
+        return true;
+    }
+
+    public boolean visitLower(EJBQLExpression expression, int finishedChildIndex) {
+        if (finishedChildIndex < 0) {
+            context.append(" {fn LCASE(");
+        }
+        else if (finishedChildIndex + 1 == expression.getChildrenCount()) {
+            context.append(")}");
+        }
+
+        return true;
+    }
+
+    public boolean visitUpper(EJBQLExpression expression, int finishedChildIndex) {
+        if (finishedChildIndex < 0) {
+            context.append(" {fn UCASE(");
+        }
+        else if (finishedChildIndex + 1 == expression.getChildrenCount()) {
+            context.append(")}");
+        }
+
+        return true;
+    }
+
+    public boolean visitLength(EJBQLExpression expression, int finishedChildIndex) {
+        if (finishedChildIndex < 0) {
+            context.append(" {fn LENGTH(");
+        }
+        else if (finishedChildIndex + 1 == expression.getChildrenCount()) {
+            context.append(")}");
+        }
+
+        return true;
+    }
+
+    public boolean visitLocate(EJBQLExpression expression, int finishedChildIndex) {
+        if (finishedChildIndex < 0) {
+            context.append(" {fn LOCATE(");
+        }
+        else if (finishedChildIndex + 1 == expression.getChildrenCount()) {
+            context.append(")}");
+        }
+        else {
+            context.append(',');
+        }
+
+        return true;
+    }
+
+    public boolean visitTrim(EJBQLExpression expression, int finishedChildIndex) {
+        if (finishedChildIndex < 0) {
+
+            if (!(expression.getChild(0) instanceof EJBQLTrimSpecification)) {
+                context.append(" {fn LTRIM({fn RTRIM(");
+            }
+        }
+        else if (finishedChildIndex + 1 == expression.getChildrenCount()) {
+            if (!(expression.getChild(0) instanceof EJBQLTrimSpecification)
+                    || expression.getChild(0) instanceof EJBQLTrimBoth) {
+                context.append(")})}");
+            }
+            else {
+                context.append(")}");
+            }
+        }
+
+        return true;
+    }
+
+    public boolean visitTrimCharacter(EJBQLExpression expression) {
+        // this is expected to be overwritten in adapter-specific translators
+        throw new UnsupportedOperationException("Not implemented in a generic translator");
+    }
+
+    public boolean visitTrimLeading(EJBQLExpression expression) {
+        context.append(" {fn LTRIM(");
+        return false;
+    }
+
+    public boolean visitTrimTrailing(EJBQLExpression expression) {
+        context.append(" {fn RTRIM(");
+        return false;
+    }
+
+    public boolean visitTrimBoth(EJBQLExpression expression) {
+        context.append(" {fn LTRIM({fn RTRIM(");
+        return false;
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/EJBQLBaseVisitor.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/EJBQLBaseVisitor.java?view=diff&rev=564988&r1=564987&r2=564988
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/EJBQLBaseVisitor.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/EJBQLBaseVisitor.java
Sat Aug 11 17:32:07 2007
@@ -42,7 +42,7 @@
         this.continueFlag = continueFlag;
     }
 
-    public boolean visitAbs(EJBQLExpression expression) {
+    public boolean visitAbs(EJBQLExpression expression, int finishedChildIndex) {
         return continueFlag;
     }
 
@@ -90,7 +90,7 @@
         return continueFlag;
     }
 
-    public boolean visitConcat(EJBQLExpression expression) {
+    public boolean visitConcat(EJBQLExpression expression, int finishedChildIndex) {
         return continueFlag;
     }
 
@@ -210,7 +210,7 @@
         return continueFlag;
     }
 
-    public boolean visitLength(EJBQLExpression expression) {
+    public boolean visitLength(EJBQLExpression expression, int finishedChildIndex) {
         return continueFlag;
     }
 
@@ -226,11 +226,11 @@
         return continueFlag;
     }
 
-    public boolean visitLocate(EJBQLExpression expression) {
+    public boolean visitLocate(EJBQLExpression expression, int finishedChildIndex) {
         return continueFlag;
     }
 
-    public boolean visitLower(EJBQLExpression expression) {
+    public boolean visitLower(EJBQLExpression expression, int finishedChildIndex) {
         return continueFlag;
     }
 
@@ -246,7 +246,7 @@
         return continueFlag;
     }
 
-    public boolean visitMod(EJBQLExpression expression) {
+    public boolean visitMod(EJBQLExpression expression, int finishedChildIndex) {
         return continueFlag;
     }
 
@@ -322,7 +322,7 @@
         return continueFlag;
     }
 
-    public boolean visitSqrt(EJBQLExpression expression) {
+    public boolean visitSqrt(EJBQLExpression expression, int finishedChildIndex) {
         return continueFlag;
     }
 
@@ -334,7 +334,7 @@
         return continueFlag;
     }
 
-    public boolean visitSubstring(EJBQLExpression expression) {
+    public boolean visitSubstring(EJBQLExpression expression, int finishedChildIndex) {
         return continueFlag;
     }
 
@@ -350,7 +350,7 @@
         return continueFlag;
     }
 
-    public boolean visitTrim(EJBQLExpression expression) {
+    public boolean visitTrim(EJBQLExpression expression, int finishedChildIndex) {
         return continueFlag;
     }
 
@@ -386,7 +386,7 @@
         return continueFlag;
     }
 
-    public boolean visitUpper(EJBQLExpression expression) {
+    public boolean visitUpper(EJBQLExpression expression, int finishedChildIndex) {
         return continueFlag;
     }
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/EJBQLExpressionVisitor.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/EJBQLExpressionVisitor.java?view=diff&rev=564988&r1=564987&r2=564988
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/EJBQLExpressionVisitor.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/EJBQLExpressionVisitor.java
Sat Aug 11 17:32:07 2007
@@ -32,7 +32,7 @@
  */
 public interface EJBQLExpressionVisitor {
 
-    boolean visitAbs(EJBQLExpression expression);
+    boolean visitAbs(EJBQLExpression expression, int finishedChildIndex);
 
     boolean visitAbstractSchemaName(EJBQLExpression expression);
 
@@ -81,7 +81,7 @@
 
     boolean visitClassName(EJBQLExpression expression);
 
-    boolean visitConcat(EJBQLExpression expression);
+    boolean visitConcat(EJBQLExpression expression, int finishedChildIndex);
 
     boolean visitConstructor(EJBQLExpression expression);
 
@@ -175,7 +175,7 @@
 
     boolean visitIsNull(EJBQLExpression expression, int finishedChildIndex);
 
-    boolean visitLength(EJBQLExpression expression);
+    boolean visitLength(EJBQLExpression expression, int finishedChildIndex);
 
     /**
      * Called on visiting "<=" expression and also after visiting every expression child.
@@ -208,9 +208,9 @@
      */
     boolean visitLike(EJBQLExpression expression, int finishedChildIndex);
 
-    boolean visitLocate(EJBQLExpression expression);
+    boolean visitLocate(EJBQLExpression expression, int finishedChildIndex);
 
-    boolean visitLower(EJBQLExpression expression);
+    boolean visitLower(EJBQLExpression expression, int finishedChildIndex);
 
     boolean visitMax(EJBQLAggregateColumn expression);
 
@@ -218,7 +218,7 @@
 
     boolean visitMin(EJBQLAggregateColumn expression);
 
-    boolean visitMod(EJBQLExpression expression);
+    boolean visitMod(EJBQLExpression expression, int finishedChildIndex);
 
     /**
      * Called on visiting "*" expression and also after visiting every expression child.
@@ -289,13 +289,13 @@
 
     boolean visitSize(EJBQLExpression expression);
 
-    boolean visitSqrt(EJBQLExpression expression);
+    boolean visitSqrt(EJBQLExpression expression, int finishedChildIndex);
 
     boolean visitStringLiteral(EJBQLExpression expression);
 
     boolean visitSubselect(EJBQLExpression expression);
 
-    boolean visitSubstring(EJBQLExpression expression);
+    boolean visitSubstring(EJBQLExpression expression, int finishedChildIndex);
 
     /**
      * Called on visiting "subtract" expression and also after visiting every expression
@@ -312,7 +312,7 @@
 
     boolean visitTok(EJBQLExpression expression);
 
-    boolean visitTrim(EJBQLExpression expression);
+    boolean visitTrim(EJBQLExpression expression, int finishedChildIndex);
 
     boolean visitTrimBoth(EJBQLExpression expression);
 
@@ -330,7 +330,7 @@
 
     boolean visitUpdateValue(EJBQLExpression expression);
 
-    boolean visitUpper(EJBQLExpression expression);
+    boolean visitUpper(EJBQLExpression expression, int finishedChildIndex);
 
     boolean visitWhere(EJBQLExpression expression);
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLAbs.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLAbs.java?view=diff&rev=564988&r1=564987&r2=564988
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLAbs.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLAbs.java
Sat Aug 11 17:32:07 2007
@@ -31,6 +31,11 @@
     }
 
     protected boolean visitNode(EJBQLExpressionVisitor visitor) {
-        return visitor.visitAbs(this);
+        return visitor.visitAbs(this, -1);
+    }
+
+    protected boolean visitChild(EJBQLExpressionVisitor visitor, int childIndex) {
+        return super.visitChild(visitor, childIndex)
+                && visitor.visitAbs(this, childIndex);
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLConcat.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLConcat.java?view=diff&rev=564988&r1=564987&r2=564988
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLConcat.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLConcat.java
Sat Aug 11 17:32:07 2007
@@ -31,6 +31,11 @@
     }
 
     protected boolean visitNode(EJBQLExpressionVisitor visitor) {
-        return visitor.visitConcat(this);
+        return visitor.visitConcat(this, -1);
+    }
+    
+    protected boolean visitChild(EJBQLExpressionVisitor visitor, int childIndex) {
+        return super.visitChild(visitor, childIndex)
+                && visitor.visitConcat(this, childIndex);
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLLength.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLLength.java?view=diff&rev=564988&r1=564987&r2=564988
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLLength.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLLength.java
Sat Aug 11 17:32:07 2007
@@ -31,6 +31,11 @@
     }
 
     protected boolean visitNode(EJBQLExpressionVisitor visitor) {
-        return visitor.visitLength(this);
+        return visitor.visitLength(this, -1);
+    }
+
+    protected boolean visitChild(EJBQLExpressionVisitor visitor, int childIndex) {
+        return super.visitChild(visitor, childIndex)
+                && visitor.visitLength(this, childIndex);
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLLocate.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLLocate.java?view=diff&rev=564988&r1=564987&r2=564988
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLLocate.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLLocate.java
Sat Aug 11 17:32:07 2007
@@ -31,6 +31,11 @@
     }
 
     protected boolean visitNode(EJBQLExpressionVisitor visitor) {
-        return visitor.visitLocate(this);
+        return visitor.visitLocate(this, -1);
+    }
+
+    protected boolean visitChild(EJBQLExpressionVisitor visitor, int childIndex) {
+        return super.visitChild(visitor, childIndex)
+                && visitor.visitLocate(this, childIndex);
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLLower.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLLower.java?view=diff&rev=564988&r1=564987&r2=564988
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLLower.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLLower.java
Sat Aug 11 17:32:07 2007
@@ -31,6 +31,11 @@
     }
 
     protected boolean visitNode(EJBQLExpressionVisitor visitor) {
-        return visitor.visitLower(this);
+        return visitor.visitLower(this, -1);
+    }
+    
+    protected boolean visitChild(EJBQLExpressionVisitor visitor, int childIndex) {
+        return super.visitChild(visitor, childIndex)
+                && visitor.visitLower(this, childIndex);
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLMod.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLMod.java?view=diff&rev=564988&r1=564987&r2=564988
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLMod.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLMod.java
Sat Aug 11 17:32:07 2007
@@ -31,6 +31,11 @@
     }
 
     protected boolean visitNode(EJBQLExpressionVisitor visitor) {
-        return visitor.visitMod(this);
+        return visitor.visitMod(this, -1);
+    }
+
+    protected boolean visitChild(EJBQLExpressionVisitor visitor, int childIndex) {
+        return super.visitChild(visitor, childIndex)
+                && visitor.visitMod(this, childIndex);
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLSqrt.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLSqrt.java?view=diff&rev=564988&r1=564987&r2=564988
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLSqrt.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLSqrt.java
Sat Aug 11 17:32:07 2007
@@ -31,6 +31,11 @@
     }
 
     protected boolean visitNode(EJBQLExpressionVisitor visitor) {
-        return visitor.visitSqrt(this);
+        return visitor.visitSqrt(this, -1);
+    }
+
+    protected boolean visitChild(EJBQLExpressionVisitor visitor, int childIndex) {
+        return super.visitChild(visitor, childIndex)
+                && visitor.visitSqrt(this, childIndex);
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLSubstring.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLSubstring.java?view=diff&rev=564988&r1=564987&r2=564988
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLSubstring.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLSubstring.java
Sat Aug 11 17:32:07 2007
@@ -31,6 +31,11 @@
     }
 
     protected boolean visitNode(EJBQLExpressionVisitor visitor) {
-        return visitor.visitSubstring(this);
+        return visitor.visitSubstring(this, -1);
+    }
+    
+    protected boolean visitChild(EJBQLExpressionVisitor visitor, int childIndex) {
+        return super.visitChild(visitor, childIndex)
+                && visitor.visitSubstring(this, childIndex);
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLTrim.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLTrim.java?view=diff&rev=564988&r1=564987&r2=564988
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLTrim.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLTrim.java
Sat Aug 11 17:32:07 2007
@@ -31,6 +31,11 @@
     }
 
     protected boolean visitNode(EJBQLExpressionVisitor visitor) {
-        return visitor.visitTrim(this);
+        return visitor.visitTrim(this, -1);
+    }
+    
+    protected boolean visitChild(EJBQLExpressionVisitor visitor, int childIndex) {
+        return super.visitChild(visitor, childIndex)
+                && visitor.visitTrim(this, childIndex);
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLTrimBoth.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLTrimBoth.java?view=diff&rev=564988&r1=564987&r2=564988
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLTrimBoth.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLTrimBoth.java
Sat Aug 11 17:32:07 2007
@@ -24,7 +24,7 @@
  * @since 3.0
  * @author Andrus Adamchik
  */
-public class EJBQLTrimBoth extends SimpleNode {
+public class EJBQLTrimBoth extends EJBQLTrimSpecification {
 
     public EJBQLTrimBoth(int id) {
         super(id);

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLTrimLeading.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLTrimLeading.java?view=diff&rev=564988&r1=564987&r2=564988
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLTrimLeading.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLTrimLeading.java
Sat Aug 11 17:32:07 2007
@@ -24,7 +24,7 @@
  * @since 3.0
  * @author Andrus Adamchik
  */
-public class EJBQLTrimLeading extends SimpleNode {
+public class EJBQLTrimLeading extends EJBQLTrimSpecification {
 
     public EJBQLTrimLeading(int id) {
         super(id);

Added: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLTrimSpecification.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLTrimSpecification.java?view=auto&rev=564988
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLTrimSpecification.java
(added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLTrimSpecification.java
Sat Aug 11 17:32:07 2007
@@ -0,0 +1,31 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+package org.apache.cayenne.ejbql.parser;
+
+/**
+ * @since 3.0
+ * @author Andrus Adamchik
+ */
+public class EJBQLTrimSpecification extends SimpleNode {
+
+    public EJBQLTrimSpecification(int id) {
+        super(id);
+    }
+
+}

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLTrimTrailing.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLTrimTrailing.java?view=diff&rev=564988&r1=564987&r2=564988
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLTrimTrailing.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLTrimTrailing.java
Sat Aug 11 17:32:07 2007
@@ -24,7 +24,7 @@
  * @since 3.0
  * @author Andrus Adamchik
  */
-public class EJBQLTrimTrailing extends SimpleNode {
+public class EJBQLTrimTrailing extends EJBQLTrimSpecification {
 
     public EJBQLTrimTrailing(int id) {
         super(id);

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLUpper.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLUpper.java?view=diff&rev=564988&r1=564987&r2=564988
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLUpper.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/ejbql/parser/EJBQLUpper.java
Sat Aug 11 17:32:07 2007
@@ -31,6 +31,11 @@
     }
 
     protected boolean visitNode(EJBQLExpressionVisitor visitor) {
-        return visitor.visitUpper(this);
+        return visitor.visitUpper(this, -1);
+    }
+    
+    protected boolean visitChild(EJBQLExpressionVisitor visitor, int childIndex) {
+        return super.visitChild(visitor, childIndex)
+                && visitor.visitUpper(this, childIndex);
     }
 }

Added: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLFunctionalExpressions.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLFunctionalExpressions.java?view=auto&rev=564988
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLFunctionalExpressions.java
(added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLFunctionalExpressions.java
Sat Aug 11 17:32:07 2007
@@ -0,0 +1,392 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+package org.apache.cayenne.access;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Calendar;
+import java.util.List;
+
+import org.apache.art.Artist;
+import org.apache.art.BigDecimalEntity;
+import org.apache.art.BigIntegerEntity;
+import org.apache.art.DateTestEntity;
+import org.apache.cayenne.ObjectContext;
+import org.apache.cayenne.query.EJBQLQuery;
+import org.apache.cayenne.unit.CayenneCase;
+
+public class DataContextEJBQLFunctionalExpressions extends CayenneCase {
+
+    protected void setUp() throws Exception {
+        deleteTestData();
+    }
+
+    public void testCURRENT_DATE() {
+
+        ObjectContext context = createDataContext();
+        Calendar cal = Calendar.getInstance();
+        int year = cal.get(Calendar.YEAR);
+
+        DateTestEntity o1 = (DateTestEntity) context.newObject(DateTestEntity.class);
+        cal.set(year - 3, 1, 1);
+        o1.setDateColumn(cal.getTime());
+
+        DateTestEntity o2 = (DateTestEntity) context.newObject(DateTestEntity.class);
+        cal.set(year + 3, 1, 1);
+        o2.setDateColumn(cal.getTime());
+
+        context.commitChanges();
+
+        EJBQLQuery query = new EJBQLQuery(
+                "SELECT d FROM DateTestEntity d WHERE d.dateColumn > CURRENT_DATE");
+        List objects = context.performQuery(query);
+        assertEquals(1, objects.size());
+        assertTrue(objects.contains(o2));
+    }
+
+    public void testCURRENT_TIME() {
+
+        ObjectContext context = createDataContext();
+        Calendar cal = Calendar.getInstance();
+        int year = cal.get(Calendar.YEAR);
+
+        DateTestEntity o1 = (DateTestEntity) context.newObject(DateTestEntity.class);
+        cal.set(year, 1, 1, 0, 0, 0);
+        o1.setTimeColumn(cal.getTime());
+
+        DateTestEntity o2 = (DateTestEntity) context.newObject(DateTestEntity.class);
+        cal.set(year, 1, 1, 23, 59, 59);
+        o2.setTimeColumn(cal.getTime());
+
+        context.commitChanges();
+
+        EJBQLQuery query = new EJBQLQuery(
+                "SELECT d FROM DateTestEntity d WHERE d.timeColumn < CURRENT_TIME");
+        List objects = context.performQuery(query);
+        assertEquals(1, objects.size());
+        assertTrue(objects.contains(o1));
+    }
+
+    public void testCURRENT_TIMESTAMP() {
+
+        ObjectContext context = createDataContext();
+        Calendar cal = Calendar.getInstance();
+        int year = cal.get(Calendar.YEAR);
+        int month = cal.get(Calendar.MONTH);
+        int date = cal.get(Calendar.DATE);
+
+        DateTestEntity o1 = (DateTestEntity) context.newObject(DateTestEntity.class);
+        cal.set(year, month, date, 0, 0, 0);
+        o1.setTimestampColumn(cal.getTime());
+
+        DateTestEntity o2 = (DateTestEntity) context.newObject(DateTestEntity.class);
+        cal.set(year, month, date, 23, 59, 59);
+        o2.setTimestampColumn(cal.getTime());
+
+        context.commitChanges();
+
+        EJBQLQuery query = new EJBQLQuery(
+                "SELECT d FROM DateTestEntity d WHERE d.timestampColumn < CURRENT_TIMESTAMP");
+        List objects = context.performQuery(query);
+        assertEquals(1, objects.size());
+        assertTrue(objects.contains(o1));
+    }
+
+    public void testABS() {
+        ObjectContext context = createDataContext();
+
+        BigDecimalEntity o1 = (BigDecimalEntity) context
+                .newObject(BigDecimalEntity.class);
+        o1.setBigDecimalField(new BigDecimal("4.1"));
+
+        BigDecimalEntity o2 = (BigDecimalEntity) context
+                .newObject(BigDecimalEntity.class);
+        o2.setBigDecimalField(new BigDecimal("-5.1"));
+
+        context.commitChanges();
+
+        EJBQLQuery query = new EJBQLQuery(
+                "SELECT d FROM BigDecimalEntity d WHERE ABS(d.bigDecimalField) > 4.5");
+        List objects = context.performQuery(query);
+        assertEquals(1, objects.size());
+        assertTrue(objects.contains(o2));
+    }
+
+    public void testSQRT() {
+        ObjectContext context = createDataContext();
+
+        BigDecimalEntity o1 = (BigDecimalEntity) context
+                .newObject(BigDecimalEntity.class);
+        o1.setBigDecimalField(new BigDecimal("9"));
+
+        BigDecimalEntity o2 = (BigDecimalEntity) context
+                .newObject(BigDecimalEntity.class);
+        o2.setBigDecimalField(new BigDecimal("16"));
+
+        context.commitChanges();
+
+        EJBQLQuery query = new EJBQLQuery(
+                "SELECT d FROM BigDecimalEntity d WHERE SQRT(d.bigDecimalField) > 3.1");
+        List objects = context.performQuery(query);
+        assertEquals(1, objects.size());
+        assertTrue(objects.contains(o2));
+    }
+
+    public void testMOD() {
+        ObjectContext context = createDataContext();
+
+        BigIntegerEntity o1 = (BigIntegerEntity) context
+                .newObject(BigIntegerEntity.class);
+        o1.setBigIntegerField(new BigInteger("9"));
+
+        BigIntegerEntity o2 = (BigIntegerEntity) context
+                .newObject(BigIntegerEntity.class);
+        o2.setBigIntegerField(new BigInteger("10"));
+
+        context.commitChanges();
+
+        EJBQLQuery query = new EJBQLQuery(
+                "SELECT d FROM BigIntegerEntity d WHERE MOD(d.bigIntegerField, 4) = 2");
+        List objects = context.performQuery(query);
+        assertEquals(1, objects.size());
+        assertTrue(objects.contains(o2));
+    }
+
+    // public void testSIZE() {
+    // ObjectContext context = createDataContext();
+    //
+    // Artist a1 = (Artist) context.newObject(Artist.class);
+    // a1.setArtistName("a1");
+    //
+    // Artist a2 = (Artist) context.newObject(Artist.class);
+    // a2.setArtistName("a2");
+    //
+    // Painting p12 = (Painting) context.newObject(Painting.class);
+    // p12.setPaintingTitle("p12");
+    // a2.addToPaintingArray(p12);
+    // Painting p22 = (Painting) context.newObject(Painting.class);
+    // p22.setPaintingTitle("p22");
+    // a2.addToPaintingArray(p22);
+    //
+    // context.commitChanges();
+    //
+    // EJBQLQuery query = new EJBQLQuery(
+    // "SELECT d FROM Artist d WHERE SIZE(d.paintingArray) = 2");
+    // List objects = context.performQuery(query);
+    // assertEquals(1, objects.size());
+    // assertTrue(objects.contains(a2));
+    //
+    // EJBQLQuery query2 = new EJBQLQuery(
+    // "SELECT d FROM Artist d WHERE SIZE(d.paintingArray) = 0");
+    // List objects2 = context.performQuery(query2);
+    // assertEquals(1, objects2.size());
+    // assertTrue(objects2.contains(a1));
+    // }
+
+    public void testCONCAT() {
+        ObjectContext context = createDataContext();
+
+        Artist a1 = (Artist) context.newObject(Artist.class);
+        a1.setArtistName("a1");
+
+        Artist a2 = (Artist) context.newObject(Artist.class);
+        a2.setArtistName("a2");
+        context.commitChanges();
+
+        EJBQLQuery query = new EJBQLQuery(
+                "SELECT a FROM Artist a WHERE CONCAT(a.artistName, a.artistName) = 'a1a1'");
+        List objects = context.performQuery(query);
+        assertEquals(1, objects.size());
+        assertTrue(objects.contains(a1));
+    }
+
+    public void testSUBSTRING() {
+        ObjectContext context = createDataContext();
+
+        Artist a1 = (Artist) context.newObject(Artist.class);
+        a1.setArtistName("12345678");
+
+        Artist a2 = (Artist) context.newObject(Artist.class);
+        a2.setArtistName("abcdefg");
+        context.commitChanges();
+
+        EJBQLQuery query = new EJBQLQuery(
+                "SELECT a FROM Artist a WHERE SUBSTRING(a.artistName, 2, 3) = 'bcd'");
+        List objects = context.performQuery(query);
+        assertEquals(1, objects.size());
+        assertTrue(objects.contains(a2));
+    }
+
+    public void testLOWER() {
+        ObjectContext context = createDataContext();
+
+        Artist a1 = (Artist) context.newObject(Artist.class);
+        a1.setArtistName("ABCDEFG");
+
+        Artist a2 = (Artist) context.newObject(Artist.class);
+        a2.setArtistName("abcdefg");
+        context.commitChanges();
+
+        Artist a3 = (Artist) context.newObject(Artist.class);
+        a3.setArtistName("Xabcdefg");
+        context.commitChanges();
+
+        EJBQLQuery query = new EJBQLQuery(
+                "SELECT a FROM Artist a WHERE LOWER(a.artistName) = 'abcdefg'");
+        List objects = context.performQuery(query);
+        assertEquals(2, objects.size());
+        assertTrue(objects.contains(a1));
+        assertTrue(objects.contains(a2));
+    }
+
+    public void testUPPER() {
+        ObjectContext context = createDataContext();
+
+        Artist a1 = (Artist) context.newObject(Artist.class);
+        a1.setArtistName("ABCDEFG");
+
+        Artist a2 = (Artist) context.newObject(Artist.class);
+        a2.setArtistName("abcdefg");
+        context.commitChanges();
+
+        Artist a3 = (Artist) context.newObject(Artist.class);
+        a3.setArtistName("Xabcdefg");
+        context.commitChanges();
+
+        EJBQLQuery query = new EJBQLQuery(
+                "SELECT a FROM Artist a WHERE UPPER(a.artistName) = UPPER('abcdefg')");
+        List objects = context.performQuery(query);
+        assertEquals(2, objects.size());
+        assertTrue(objects.contains(a1));
+        assertTrue(objects.contains(a2));
+    }
+
+    public void testLENGTH() {
+        ObjectContext context = createDataContext();
+
+        Artist a1 = (Artist) context.newObject(Artist.class);
+        a1.setArtistName("1234567");
+
+        Artist a2 = (Artist) context.newObject(Artist.class);
+        a2.setArtistName("1234567890");
+
+        Artist a3 = (Artist) context.newObject(Artist.class);
+        a3.setArtistName("1234567890-=");
+        context.commitChanges();
+
+        EJBQLQuery query = new EJBQLQuery(
+                "SELECT a FROM Artist a WHERE LENGTH(a.artistName) > 7");
+        List objects = context.performQuery(query);
+        assertEquals(2, objects.size());
+        assertTrue(objects.contains(a3));
+        assertTrue(objects.contains(a2));
+    }
+
+    public void testLOCATE() {
+        ObjectContext context = createDataContext();
+
+        Artist a1 = (Artist) context.newObject(Artist.class);
+        a1.setArtistName("___A___");
+
+        Artist a2 = (Artist) context.newObject(Artist.class);
+        a2.setArtistName("_A_____");
+        context.commitChanges();
+
+        EJBQLQuery query = new EJBQLQuery(
+                "SELECT a FROM Artist a WHERE LOCATE('A', a.artistName) = 2");
+        List objects = context.performQuery(query);
+        assertEquals(1, objects.size());
+        assertTrue(objects.contains(a2));
+    }
+
+    public void testTRIM() {
+        ObjectContext context = createDataContext();
+
+        Artist a1 = (Artist) context.newObject(Artist.class);
+        a1.setArtistName("  A");
+
+        Artist a2 = (Artist) context.newObject(Artist.class);
+        a2.setArtistName("A  ");
+        context.commitChanges();
+
+        EJBQLQuery query = new EJBQLQuery(
+                "SELECT a FROM Artist a WHERE TRIM(a.artistName) = 'A'");
+        List objects = context.performQuery(query);
+        assertEquals(2, objects.size());
+        assertTrue(objects.contains(a1));
+        assertTrue(objects.contains(a2));
+
+        query = new EJBQLQuery(
+                "SELECT a FROM Artist a WHERE TRIM(LEADING FROM a.artistName) = 'A'");
+        objects = context.performQuery(query);
+        assertEquals(1, objects.size());
+        assertTrue(objects.contains(a1));
+
+        query = new EJBQLQuery(
+                "SELECT a FROM Artist a WHERE TRIM(TRAILING FROM a.artistName) = 'A'");
+        objects = context.performQuery(query);
+        assertEquals(1, objects.size());
+        assertTrue(objects.contains(a2));
+
+        query = new EJBQLQuery(
+                "SELECT a FROM Artist a WHERE TRIM(BOTH FROM a.artistName) = 'A'");
+        objects = context.performQuery(query);
+        assertEquals(2, objects.size());
+        assertTrue(objects.contains(a1));
+        assertTrue(objects.contains(a2));
+
+    }
+    
+//    public void testTRIMChar() {
+//        ObjectContext context = createDataContext();
+//
+//        Artist a1 = (Artist) context.newObject(Artist.class);
+//        a1.setArtistName("XXXA");
+//
+//        Artist a2 = (Artist) context.newObject(Artist.class);
+//        a2.setArtistName("AXXX");
+//        context.commitChanges();
+//
+//        EJBQLQuery query = new EJBQLQuery(
+//                "SELECT a FROM Artist a WHERE TRIM('X' FROM a.artistName) = 'A'");
+//        List objects = context.performQuery(query);
+//        assertEquals(2, objects.size());
+//        assertTrue(objects.contains(a1));
+//        assertTrue(objects.contains(a2));
+//
+//        query = new EJBQLQuery(
+//                "SELECT a FROM Artist a WHERE TRIM(LEADING 'X' FROM a.artistName) = 'A'");
+//        objects = context.performQuery(query);
+//        assertEquals(1, objects.size());
+//        assertTrue(objects.contains(a1));
+//
+//        query = new EJBQLQuery(
+//                "SELECT a FROM Artist a WHERE TRIM(TRAILING 'X' FROM a.artistName) = 'A'");
+//        objects = context.performQuery(query);
+//        assertEquals(1, objects.size());
+//        assertTrue(objects.contains(a2));
+//
+//        query = new EJBQLQuery(
+//                "SELECT a FROM Artist a WHERE TRIM(BOTH 'X' FROM a.artistName) = 'A'");
+//        objects = context.performQuery(query);
+//        assertEquals(2, objects.size());
+//        assertTrue(objects.contains(a1));
+//        assertTrue(objects.contains(a2));
+//    }
+}

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/testdo/inherit/auto/_Department.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/testdo/inherit/auto/_Department.java?view=diff&rev=564988&r1=564987&r2=564988
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/testdo/inherit/auto/_Department.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/testdo/inherit/auto/_Department.java
Sat Aug 11 17:32:07 2007
@@ -34,15 +34,13 @@
     }
     
     
-    public void addToToManager(org.apache.cayenne.testdo.inherit.Manager obj) {
-        addToManyTarget("toManager", obj, true);
-    }
-    public void removeFromToManager(org.apache.cayenne.testdo.inherit.Manager obj) {
-        removeToManyTarget("toManager", obj, true);
-    }
-    public List getToManager() {
-        return (List)readProperty("toManager");
+    public void setToManager(org.apache.cayenne.testdo.inherit.Manager toManager) {
+        setToOneTarget("toManager", toManager, true);
     }
+
+    public org.apache.cayenne.testdo.inherit.Manager getToManager() {
+        return (org.apache.cayenne.testdo.inherit.Manager)readProperty("toManager");
+    } 
     
     
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/resources/people.map.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/resources/people.map.xml?view=diff&rev=564988&r1=564987&r2=564988
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/resources/people.map.xml
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/resources/people.map.xml
Sat Aug 11 17:32:07 2007
@@ -76,7 +76,7 @@
 	<obj-relationship name="representatives" source="ClientCompany" target="CustomerRepresentative"
db-relationship-path="representatives"/>
 	<obj-relationship name="toClientCompany" source="CustomerRepresentative" target="ClientCompany"
db-relationship-path="toClientCompany"/>
 	<obj-relationship name="employees" source="Department" target="Employee" db-relationship-path="employees"/>
-	<obj-relationship name="toManager" source="Department" target="Manager" db-relationship-path="employees"/>
+	<obj-relationship name="toManager" source="Department" target="Manager" db-relationship-path="toManager"/>
 	<obj-relationship name="addresses" source="Employee" target="Address" db-relationship-path="employeeAddresses"/>
 	<obj-relationship name="toDepartment" source="Employee" target="Department" db-relationship-path="toDepartment"/>
 	<obj-relationship name="managedDepartments" source="Manager" target="Department" db-relationship-path="managedDepartments"/>



Mime
View raw message