# HG changeset patch
# User Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
# Date 1683156532 -7200
# Node ID 99ff3cd9f4f0d91fb93b1e81759bf87865832a16
# Parent  b6eb51cb5ceedd149ae014395fc1fd471d849cb0
Corrected DatabaseMetaData method getStringFunctions() when connected to a Jun2023 server.
It now includes the string functions from the new txtsim module.

diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
 # ChangeLog file for monetdb-java
 # This file is updated with Maddlog
 
+* Thu May  4 2023 Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
+- Corrected DatabaseMetaData method getStringFunctions() when connected
+  to Jun2023 server. It now includes the string functions from the new
+  txtsim module.
+
 * Thu Feb 23 2023 Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
 - Compiled and released new jar files: monetdb-jdbc-3.3.jre8.jar and
   jdbcclient.jre8.jar
diff --git a/src/main/java/org/monetdb/jdbc/MonetDatabaseMetaData.java b/src/main/java/org/monetdb/jdbc/MonetDatabaseMetaData.java
--- a/src/main/java/org/monetdb/jdbc/MonetDatabaseMetaData.java
+++ b/src/main/java/org/monetdb/jdbc/MonetDatabaseMetaData.java
@@ -408,7 +408,7 @@ public final class MonetDatabaseMetaData
 	 * @return a String of query result values concatenated into one string, and values separated by comma's
 	 */
 	private String getConcatenatedStringFromQuery(final String query) {
-		final StringBuilder sb = new StringBuilder(1024);
+		final StringBuilder sb = new StringBuilder(1200);
 		Statement st = null;
 		ResultSet rs = null;
 		try {
@@ -432,7 +432,7 @@ public final class MonetDatabaseMetaData
 		} finally {
 			MonetConnection.closeResultsetStatement(rs, st);
 		}
-		// for debug: System.out.println("SQL (len " + query.length() + "): " + query + "\nResult string: " + sb.toString());
+		// for debug: System.out.println("SQL (len " + query.length() + "): " + query + "\nResult string(len " + sb.length() + "): " + sb.toString());
 		return sb.toString();
 	}
 
@@ -464,8 +464,9 @@ public final class MonetDatabaseMetaData
 			// exclude sql functions: get_value_for, next_value_for, restart
 			" AND \"mod\" <> 'sql')" +
 			// include specific functions code(int) and space(int) which belong to the 'str' module
-			" OR \"mod\" = 'str'" +
-			// include 3 specific json functions, md5(), ms_stuff() and udf reverse() which all accept a string arg
+			// include functions (difference, editdistance, editdistance2, levenshtein, qgramnormalize, similarity, soundex) which since Jun2023 are in the 'txtsim' module
+			" OR (\"mod\" IN ('str','txtsim') AND \"type\" = 1)" +
+			// include 3 specific json functions and md5(), ms_stuff() and udf reverse() which all accept a string arg
 			" OR f.\"name\" IN ('isarray','isobject','isvalid','md5','ms_stuff','reverse')";
 		final String unionPart =
 			// add functions which are not listed in sys.functions but implemented in the SQL parser (see sql/server/sql_parser.y)