diff src/main/java/org/monetdb/jdbc/MonetCallableStatement.java @ 736:f317b37bad30

In MonetCallableStatement constructor skip calling removeEscapes() when the connected server supports ODBC/JDBC escape sequence syntax.
author Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
date Thu, 16 Feb 2023 20:35:09 +0100 (2023-02-16)
parents aeb268156580
children e890195256ac
line wrap: on
line diff
--- a/src/main/java/org/monetdb/jdbc/MonetCallableStatement.java
+++ b/src/main/java/org/monetdb/jdbc/MonetCallableStatement.java
@@ -35,26 +35,31 @@ import java.util.Map;
  * A {@link CallableStatement} suitable for the MonetDB database.
  *
  * The interface used to execute SQL stored procedures.
- * The JDBC API provides a stored procedure SQL escape syntax that allows stored procedures to be called in a standard way for all RDBMSs.
- * This escape syntax has one form that includes a result parameter (MonetDB does not support this) and one that does not.
- * If used, the result parameter must be registered as an OUT parameter (MonetDB does not support this).
- * The other parameters can be used for input, output or both. Parameters are referred to sequentially, by number, with the first parameter being 1.
- *
- *  { call procedure-name [ (arg1, arg2, ...) ] }
- *  { ?= call procedure-name [ (arg1, arg2, ...) ] }
+ * The JDBC API provides a stored procedure SQL escape syntax that allows
+ * stored procedures to be called in a standard way for all RDBMSs.
+ * This escape syntax has one form that includes a result parameter (MonetDB
+ * does not support this) and one that does not. If used, the result parameter
+ * must be registered as an OUT parameter (MonetDB does not support this).
+ * The other parameters can be used for input, output or both.
+ * Parameters are referred to sequentially, by number, with the first parameter being 1.
+ *  {?= call &lt;procedure-name&gt; [ (&lt;arg1&gt;, &lt;arg2&gt;, ...) ] }
+ *  {call &lt;procedure-name&gt; [ (&lt;arg1&gt;, &lt;arg2&gt;, ...) ] }
  *
  * IN parameter values are set using the set methods inherited from PreparedStatement.
  * The type of all OUT parameters must be registered prior to executing the stored procedure;
  * their values are retrieved after execution via the get methods provided here.
- * <b>Note</b>: MonetDB does not support OUT or INOUT parameters. Only input parameters are supported.
+ * <b>Note</b>: MonetDB does NOT support OUT or INOUT parameters. Only IN parameters are supported.
  *
  * A CallableStatement can return one ResultSet object or multiple ResultSet objects.
  * Multiple ResultSet objects are handled using operations inherited from Statement.
  *
- * For maximum portability, a call's ResultSet objects and update counts should be processed prior to getting the values of output parameters.
+ * For maximum portability, a call's ResultSet objects and update counts
+ * should be processed prior to getting the values of output parameters.
  *
- * This implementation of the CallableStatement interface reuses the implementation of MonetPreparedStatement for
- * preparing the call statement, bind parameter values and execute the call, possibly multiple times with different parameter values.
+ * This implementation of the CallableStatement interface reuses the
+ * implementation of MonetPreparedStatement for preparing the call statement,
+ * bind parameter values and execute the call, possibly multiple times with
+ * different parameter values.
  *
  * Note: currently we can not implement:
  * - all getXyz(parameterIndex/parameterName, ...) methods
@@ -64,7 +69,7 @@ import java.util.Map;
  *</pre>
  *
  * @author Martin van Dinther
- * @version 1.1
+ * @version 1.2
  */
 
 public final class MonetCallableStatement
@@ -82,9 +87,9 @@ public final class MonetCallableStatemen
 	 * @param resultSetHoldability holdability of ResultSet to produce
 	 * @param callQuery - an SQL CALL statement that may contain one or more '?' parameter placeholders.
 	 *	Typically this statement is specified using JDBC call escape syntax:
-	 *	{ call procedure_name [(?,?, ...)] }
+	 *	{ call &lt;procedure_name&gt; [(?,?, ...)] }
 	 *	or
-	 *	{ ?= call procedure_name [(?,?, ...)] }
+	 *	{ ?= call &lt;procedure_name&gt; [(?,?, ...)] }
 	 * @throws SQLException if an error occurs during creation
 	 * @throws IllegalArgumentException is one of the arguments is null or empty
 	 */
@@ -101,11 +106,12 @@ public final class MonetCallableStatemen
 			resultSetType,
 			resultSetConcurrency,
 			resultSetHoldability,
-			removeEscapes(callQuery)
+			connection.supportsEscapeSequenceSyntax() ? callQuery : removeEscapes(callQuery)
 		);
 	}
 
-	/** parse call query string on
+	/**
+	 * Parse call query string on
 	 *  { [?=] call &lt;procedure-name&gt; [(&lt;arg1&gt;,&lt;arg2&gt;, ...)] }
 	 * and remove the JDBC escapes pairs: { and }
 	 *