The correct thing to do is actually implement GROUP_CONCAT. Just check the 
code base and find all the uses of Token.T_SUM and Expression.SUM. Then add 
a new Token.T_GROUP_CONCAT and a new Expression.GROUP_CONCAT and some code 
to handle this case to all the places where Token.T_SUM and Expression.SUM 
are used. It's actually quite simple.

Fred

----- Original Message ----- 
From: "Werner, Wolfgang" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: 09 September 2005 01:35
Subject: Re: [Hsqldb-developers] SUM for Strings


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi again,

I just noticed that my change breaks some of the unit tests. I'll have
another look at it.

Sorry for bothering,
Wolfgang

Werner, Wolfgang wrote:
> Hi,
>
> I needed something similar to MySQLs GROUP_CONCAT and came up with the
> following hack:
> I simply added a concat operation for VARCHAR to the SUM function. This
> is my first contact with hsqldb, so if this patch is a bad idea please
> clarify.
> I guess it would be more consistent to add a completely new aggregate
> function, but does it do any harm this way?
>
> I didn't want to post it on the patch tracker since I'm new to the list
> and don't know if this is appropriate, so it is attached.
>
> Btw. hsqldb is really great work. Using it the first time today and
> already loving it. Thanks!
>
> Regards,
> Wolfgang
>
> <diff args='-cb'>
> *** SetFunction.java Fri Jul  8 16:13:00 2005
> --- SetFunction.java.ww Fri Sep  9 02:22:26 2005
> ***************
> *** 137,142 ****
> --- 137,150 ----
>                                   currentBigDecimal.add((BigDecimal) 
> item);
>                           }
>
> +                     case Types.VARCHAR:
> +                         if (currentValue == null) {
> +                             currentValue = (String) item;
> +                         } else {
> +                             currentValue =
> + currentValue.toString().concat((String)item);
> +                         }
> +
>                           return;
>
>                       default :
> ***************
> *** 266,271 ****
> --- 274,282 ----
>                       case Types.DECIMAL :
>                           return currentBigDecimal;
>
> +                     case Types.VARCHAR:
> + return (String)currentValue;
> +
>                       default :
>                           throw Trace.error(Trace.SUM_OF_NON_NUMERIC);
>                   }
> </diff>

- -------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
hsqldb-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hsqldb-developers



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Cygwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDINjIqjaicDyx8o8RAhEUAJ9toyddM/sm3aEM+YAII53AAPZQ7ACfRQKT
4cMEljf00z2IWKUV+w1AlWE=
=LyNQ
-----END PGP SIGNATURE-----


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
hsqldb-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hsqldb-developers 



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
hsqldb-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hsqldb-developers

Reply via email to