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

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>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Cygwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDINcAqjaicDyx8o8RAiYBAJ9DimecZC4otM54TELw5a3/T5hiKQCfRy2J
EVhjJ9KuwQzGl54pZHQsw4A=
=7mTL
-----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
hsqldb-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hsqldb-developers

Reply via email to