Hi,

On Thursday 19 February 2004 05:33, Jakob Braeuchi wrote:
> hi,
>
> SqlHelper is quite a primitive thing. it assumes that there is only ONE
> column in a selectio criteria. this means it cannot handle criteria like
> this:
>
> oracle: upper(col1 || col2) = ?
> mysql: upper(concat(col1,col2)) = ?
>
> in fact the whole selection criteria handling assumes only one column :(
> i'm currently thinking about how i can get rid of this limitation. and i
> hope that we can also drop SqlHelper then.

Sorry, I had not read SqlHelper.java and around enough.
It seems SqlHelper#splitPath creates PathInfo contains suffix, prefix and  
column from criteria. And it will help creating sql statement.
At SqlQueryStatement#appendColName, PathInfo's colName is translated to 
table's column name. Then, you said only ONE column will not be translated at 
that time. 

Why don't you make PathInfo independent and move translating function to 
PathInfo.  There are two getColumn at SqlDeleteByQuery.java and 
SqlQueryStatement.java. The difference is just only table alias.
If PathInfo has translating function, you can reinforce that to be able to 
translate 2 or more columns easily. 

Anyway, StringIndexOutOfBoundsException was caused by 
the white space after "," at below row.
  query.addGroupBy("DATE_FORMAT(DATE, \"%Y/%m/%d\")");

I attached temporary patch. Try that.
I think treating 'distinct name' and ' to_char(col, 'format_mask')'  by one 
way is the cause of this problem.

Thanks.
-- 
-- shivaken
antshell: Ant command line front end
http://www.antshell.org
--- SqlHelper.java.orig	2004-02-20 10:05:54.377510232 +0900
+++ SqlHelper.java	2004-02-20 10:25:27.911106008 +0900
@@ -125,7 +125,7 @@
 			colBegin = betweenBraces.indexOf(" ");
 			// look for multiarg function like to_char(col,'format_mask')
 			colEnd = betweenBraces.indexOf(",");
-			colEnd = colEnd > 0 ? colEnd : betweenBraces.length();
+			colEnd = colEnd > 0 && colEnd > colBegin ? colEnd : betweenBraces.length();
 			prefix = aPath.substring(0, braceBegin + 1) + betweenBraces.substring(0, colBegin + 1);
 			colName = betweenBraces.substring(colBegin + 1, colEnd);
 			suffix = betweenBraces.substring(colEnd) + aPath.substring(braceEnd);

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to