changeset 156:2abd488159c4

Implemented PreparedStatement method setURL(int, URL).
author Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
date Thu, 24 Aug 2017 18:46:13 +0200 (2017-08-24)
parents 36f55bb8dd57
children 9ce094bd1bff
files ChangeLog release.txt src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java
diffstat 3 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,7 +2,8 @@
 # This file is updated with Maddlog
 
 * Thu Aug 24 2017 Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
-- Implemented PreparedStatement method setNString().
+- Implemented PreparedStatement method setURL(int, URL).
+- Implemented PreparedStatement method setNString(int, String).
 - The MonetDB JDBC driver code and jdbcclient program are now compiled
   without debug info and with optimise flag enabled.  The new jar files are
   now smaller in size.
--- a/release.txt
+++ b/release.txt
@@ -56,7 +56,7 @@ Currently implemented JDBC 4.1 interface
     - setAsciiStream, setBinaryStream, setUnicodeStream
     - setBlob
     - setNCharacterStream, setNClob
-    - setRef, setRowId, setSQLXML, setURL
+    - setRef, setRowId, setSQLXML
 
   * java.sql.ParameterMetaData
 
--- a/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java
+++ b/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java
@@ -2499,7 +2499,15 @@ public class MonetPreparedStatement
 	 */
 	@Override
 	public void setURL(int parameterIndex, URL x) throws SQLException {
-		throw newSQLFeatureNotSupportedException("setURL");
+		if (x == null) {
+			setNull(parameterIndex, -1);
+			return;
+		}
+
+		String val = x.toString();
+		setValue(parameterIndex,
+			"url '" + val.replaceAll("\\\\", "\\\\\\\\").replaceAll("'", "\\\\'") + "'"
+		);
 	}
 
 	/**