From 7dbc58d426b3fceaa851523f7184ebdb26ee0c30 Mon Sep 17 00:00:00 2001 From: Par Winzell Date: Wed, 21 Jan 2009 21:39:48 +0000 Subject: [PATCH] Function and Literal expressions can be non-deterministic but in most cases they are safe, and giving them proper toString()'s will help caching quite a bit. --- src/java/com/samskivert/depot/expression/FunctionExp.java | 7 +++++++ src/java/com/samskivert/depot/expression/LiteralExp.java | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/src/java/com/samskivert/depot/expression/FunctionExp.java b/src/java/com/samskivert/depot/expression/FunctionExp.java index d8ec5ce..a991a15 100644 --- a/src/java/com/samskivert/depot/expression/FunctionExp.java +++ b/src/java/com/samskivert/depot/expression/FunctionExp.java @@ -20,6 +20,8 @@ package com.samskivert.depot.expression; +import com.samskivert.util.StringUtil; + import java.util.Collection; import com.samskivert.depot.PersistentRecord; @@ -63,6 +65,11 @@ public class FunctionExp implements SQLExpression return _arguments; } + public String toString () + { + return _function + "(" + StringUtil.join(_arguments, ", ") + ")"; + } + /** The literal name of this function, e.g. FLOOR */ protected String _function; diff --git a/src/java/com/samskivert/depot/expression/LiteralExp.java b/src/java/com/samskivert/depot/expression/LiteralExp.java index 2085805..a46b7c8 100644 --- a/src/java/com/samskivert/depot/expression/LiteralExp.java +++ b/src/java/com/samskivert/depot/expression/LiteralExp.java @@ -53,6 +53,11 @@ public class LiteralExp return _text; } + public String toString () + { + return _text; + } + /** The literal text of this expression, e.g. COUNT(*) */ protected String _text; }