Mercurial > hg > monetdb-java
comparison src/main/java/org/monetdb/jdbc/MonetCallableStatement.java @ 391:f523727db392
Moved Java classes from packages starting with nl.cwi.monetdb.* to package org.monetdb.*
This naming complies to the Java Package Naming convention as MonetDB's main website is www.monetdb.org.
author | Martin van Dinther <martin.van.dinther@monetdbsolutions.com> |
---|---|
date | Thu, 12 Nov 2020 22:02:01 +0100 (2020-11-12) |
parents | src/main/java/nl/cwi/monetdb/jdbc/MonetCallableStatement.java@ffdc7b0e102d |
children | bf9f6b6ecf40 |
comparison
equal
deleted
inserted
replaced
390:6199e0be3c6e | 391:f523727db392 |
---|---|
1 /* | |
2 * This Source Code Form is subject to the terms of the Mozilla Public | |
3 * License, v. 2.0. If a copy of the MPL was not distributed with this | |
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
5 * | |
6 * Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. | |
7 */ | |
8 | |
9 package org.monetdb.jdbc; | |
10 | |
11 import java.io.InputStream; | |
12 import java.io.Reader; | |
13 import java.math.BigDecimal; | |
14 import java.net.URL; | |
15 import java.sql.Array; | |
16 import java.sql.Blob; | |
17 import java.sql.CallableStatement; | |
18 import java.sql.Clob; | |
19 import java.sql.Date; | |
20 import java.sql.NClob; | |
21 import java.sql.PreparedStatement; | |
22 import java.sql.Ref; | |
23 import java.sql.RowId; | |
24 import java.sql.SQLException; | |
25 import java.sql.SQLFeatureNotSupportedException; | |
26 import java.sql.SQLType; // new as of Java 1.8 | |
27 import java.sql.SQLXML; | |
28 import java.sql.Time; | |
29 import java.sql.Timestamp; | |
30 import java.util.Calendar; | |
31 import java.util.Map; | |
32 | |
33 /** | |
34 * A {@link CallableStatement} suitable for the MonetDB database. | |
35 * | |
36 * The interface used to execute SQL stored procedures. | |
37 * The JDBC API provides a stored procedure SQL escape syntax that allows stored procedures to be called in a standard way for all RDBMSs. | |
38 * This escape syntax has one form that includes a result parameter (MonetDB does not support this) and one that does not. | |
39 * If used, the result parameter must be registered as an OUT parameter (MonetDB does not support this). | |
40 * The other parameters can be used for input, output or both. Parameters are referred to sequentially, by number, with the first parameter being 1. | |
41 * | |
42 * <code> | |
43 * { call procedure-name [ (arg1, arg2, ...) ] } | |
44 * { ?= call procedure-name [ (arg1, arg2, ...) ] } | |
45 * </code> | |
46 * | |
47 * IN parameter values are set using the set methods inherited from PreparedStatement. | |
48 * The type of all OUT parameters must be registered prior to executing the stored procedure; | |
49 * their values are retrieved after execution via the get methods provided here. | |
50 * Note: MonetDB does not support OUT or INOUT parameters. Only input parameters are supported. | |
51 * | |
52 * A CallableStatement can return one ResultSet object or multiple ResultSet objects. | |
53 * Multiple ResultSet objects are handled using operations inherited from Statement. | |
54 * | |
55 * For maximum portability, a call's ResultSet objects and update counts should be processed prior to getting the values of output parameters. | |
56 * | |
57 * This implementation of the CallableStatement interface reuses the implementation of MonetPreparedStatement for | |
58 * preparing the call statement, bind parameter values and execute the call, possibly multiple times with different parameter values. | |
59 * | |
60 * Note: currently we can not implement: | |
61 * - all getXyz(parameterIndex/parameterName, ...) methods | |
62 * - all registerOutParameter(parameterIndex/parameterName, int sqlType, ...) methods | |
63 * - wasNull() method | |
64 * because output parameters in stored procedures are not supported by MonetDB. | |
65 * | |
66 * @author Martin van Dinther | |
67 * @version 1.1 | |
68 */ | |
69 | |
70 public class MonetCallableStatement | |
71 extends MonetPreparedStatement | |
72 implements CallableStatement | |
73 { | |
74 /** | |
75 * MonetCallableStatement constructor which checks the arguments for validity. | |
76 * A MonetCallableStatement is backed by a {@link MonetPreparedStatement}, | |
77 * which deals with most of the required stuff of this class. | |
78 * | |
79 * @param connection the connection that created this Statement | |
80 * @param resultSetType type of {@link ResultSet} to produce | |
81 * @param resultSetConcurrency concurrency of ResultSet to produce | |
82 * @param callQuery - an SQL CALL statement that may contain one or more '?' parameter placeholders. | |
83 * Typically this statement is specified using JDBC call escape syntax: | |
84 * { call procedure_name [(?,?, ...)] } | |
85 * or | |
86 * { ?= call procedure_name [(?,?, ...)] } | |
87 * @throws SQLException if an error occurs during creation | |
88 * @throws IllegalArgumentException is one of the arguments is null or empty | |
89 */ | |
90 MonetCallableStatement( | |
91 final MonetConnection connection, | |
92 final int resultSetType, | |
93 final int resultSetConcurrency, | |
94 final int resultSetHoldability, | |
95 final String callQuery) | |
96 throws SQLException, IllegalArgumentException | |
97 { | |
98 super( | |
99 connection, | |
100 resultSetType, | |
101 resultSetConcurrency, | |
102 resultSetHoldability, | |
103 removeEscapes(callQuery) | |
104 ); | |
105 } | |
106 | |
107 /** parse call query string on | |
108 * { [?=] call <procedure-name> [(<arg1>,<arg2>, ...)] } | |
109 * and remove the JDBC escapes pairs: { and } | |
110 */ | |
111 final private static String removeEscapes(final String query) { | |
112 if (query == null) | |
113 return null; | |
114 | |
115 final int firstAccOpen = query.indexOf("{"); | |
116 if (firstAccOpen == -1) | |
117 // nothing to remove | |
118 return query; | |
119 | |
120 final int len = query.length(); | |
121 final StringBuilder buf = new StringBuilder(len); | |
122 int countAccolades = 0; | |
123 // simple scanner which copies all characters except the first '{' and matching '}' character | |
124 // we currently do not check if 'call' appears after the first '{' and before the '}' character | |
125 // we currently also do not deal correctly with { or } appearing as comment or as part of a string value | |
126 for (int i = 0; i < len; i++) { | |
127 char c = query.charAt(i); | |
128 switch (c) { | |
129 case '{': | |
130 countAccolades++; | |
131 if (i == firstAccOpen) | |
132 continue; | |
133 else | |
134 buf.append(c); | |
135 break; | |
136 case '}': | |
137 countAccolades--; | |
138 if (i > firstAccOpen && countAccolades == 0) | |
139 continue; | |
140 else | |
141 buf.append(c); | |
142 break; | |
143 default: | |
144 buf.append(c); | |
145 } | |
146 } | |
147 return buf.toString(); | |
148 } | |
149 | |
150 /** utility method to convert a parameter name to an int (which represents the parameter index) | |
151 * this will only succeed for strings like: "1", "2", "3", etc | |
152 * throws SQLException if it cannot convert the string to an integer number | |
153 */ | |
154 final private int nameToIndex(final String parameterName) throws SQLException { | |
155 if (parameterName == null) | |
156 throw new SQLException("Missing parameterName value", "22002"); | |
157 try { | |
158 return Integer.parseInt(parameterName); | |
159 } catch (NumberFormatException nfe) { | |
160 throw new SQLException("Cannot convert parameterName '" + parameterName + "' to integer value", "22010"); | |
161 } | |
162 } | |
163 | |
164 | |
165 // methods of interface CallableStatement | |
166 | |
167 // all getXyz(parameterIndex/parameterName, ...) methods are NOT supported | |
168 // because output parameters in stored procedures are not supported by MonetDB | |
169 @Override | |
170 public Array getArray(int parameterIndex) throws SQLException { | |
171 throw newSQLFeatureNotSupportedException("getArray"); | |
172 } | |
173 @Override | |
174 public Array getArray(String parameterName) throws SQLException { | |
175 throw newSQLFeatureNotSupportedException("getArray"); | |
176 } | |
177 @Override | |
178 public BigDecimal getBigDecimal(int parameterIndex) throws SQLException { | |
179 throw newSQLFeatureNotSupportedException("getBigDecimal"); | |
180 } | |
181 @Override | |
182 @Deprecated | |
183 public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException { | |
184 throw newSQLFeatureNotSupportedException("getBigDecimal"); | |
185 } | |
186 @Override | |
187 public BigDecimal getBigDecimal(String parameterName) throws SQLException { | |
188 throw newSQLFeatureNotSupportedException("getBigDecimal"); | |
189 } | |
190 @Override | |
191 public Blob getBlob(int parameterIndex) throws SQLException { | |
192 throw newSQLFeatureNotSupportedException("getBlob"); | |
193 } | |
194 @Override | |
195 public Blob getBlob(String parameterName) throws SQLException { | |
196 throw newSQLFeatureNotSupportedException("getBlob"); | |
197 } | |
198 @Override | |
199 public boolean getBoolean(int parameterIndex) throws SQLException { | |
200 throw newSQLFeatureNotSupportedException("getBoolean"); | |
201 } | |
202 @Override | |
203 public boolean getBoolean(String parameterName) throws SQLException { | |
204 throw newSQLFeatureNotSupportedException("getBoolean"); | |
205 } | |
206 @Override | |
207 public byte getByte(int parameterIndex) throws SQLException { | |
208 throw newSQLFeatureNotSupportedException("getByte"); | |
209 } | |
210 @Override | |
211 public byte getByte(String parameterName) throws SQLException { | |
212 throw newSQLFeatureNotSupportedException("getByte"); | |
213 } | |
214 @Override | |
215 public byte[] getBytes(int parameterIndex) throws SQLException { | |
216 throw newSQLFeatureNotSupportedException("getBytes"); | |
217 } | |
218 @Override | |
219 public byte[] getBytes(String parameterName) throws SQLException { | |
220 throw newSQLFeatureNotSupportedException("getBytes"); | |
221 } | |
222 @Override | |
223 public Reader getCharacterStream(int parameterIndex) throws SQLException { | |
224 throw newSQLFeatureNotSupportedException("getCharacterStream"); | |
225 } | |
226 @Override | |
227 public Reader getCharacterStream(String parameterName) throws SQLException { | |
228 throw newSQLFeatureNotSupportedException("getCharacterStream"); | |
229 } | |
230 @Override | |
231 public Clob getClob(int parameterIndex) throws SQLException { | |
232 throw newSQLFeatureNotSupportedException("getClob"); | |
233 } | |
234 @Override | |
235 public Clob getClob(String parameterName) throws SQLException { | |
236 throw newSQLFeatureNotSupportedException("getClob"); | |
237 } | |
238 @Override | |
239 public Date getDate(int parameterIndex) throws SQLException { | |
240 throw newSQLFeatureNotSupportedException("getDate"); | |
241 } | |
242 @Override | |
243 public Date getDate(int parameterIndex, Calendar cal) throws SQLException { | |
244 throw newSQLFeatureNotSupportedException("getDate"); | |
245 } | |
246 @Override | |
247 public Date getDate(String parameterName) throws SQLException { | |
248 throw newSQLFeatureNotSupportedException("getDate"); | |
249 } | |
250 @Override | |
251 public Date getDate(String parameterName, Calendar cal) throws SQLException { | |
252 throw newSQLFeatureNotSupportedException("getDate"); | |
253 } | |
254 @Override | |
255 public double getDouble(int parameterIndex) throws SQLException { | |
256 throw newSQLFeatureNotSupportedException("getDouble"); | |
257 } | |
258 @Override | |
259 public double getDouble(String parameterName) throws SQLException { | |
260 throw newSQLFeatureNotSupportedException("getDouble"); | |
261 } | |
262 @Override | |
263 public float getFloat(int parameterIndex) throws SQLException { | |
264 throw newSQLFeatureNotSupportedException("getFloat"); | |
265 } | |
266 @Override | |
267 public float getFloat(String parameterName) throws SQLException { | |
268 throw newSQLFeatureNotSupportedException("getFloat"); | |
269 } | |
270 @Override | |
271 public int getInt(int parameterIndex) throws SQLException { | |
272 throw newSQLFeatureNotSupportedException("getInt"); | |
273 } | |
274 @Override | |
275 public int getInt(String parameterName) throws SQLException { | |
276 throw newSQLFeatureNotSupportedException("getInt"); | |
277 } | |
278 @Override | |
279 public long getLong(int parameterIndex) throws SQLException { | |
280 throw newSQLFeatureNotSupportedException("getLong"); | |
281 } | |
282 @Override | |
283 public long getLong(String parameterName) throws SQLException { | |
284 throw newSQLFeatureNotSupportedException("getLong"); | |
285 } | |
286 @Override | |
287 public Reader getNCharacterStream(int parameterIndex) throws SQLException { | |
288 throw newSQLFeatureNotSupportedException("getNCharacterStream"); | |
289 } | |
290 @Override | |
291 public Reader getNCharacterStream(String parameterName) throws SQLException { | |
292 throw newSQLFeatureNotSupportedException("getNCharacterStream"); | |
293 } | |
294 @Override | |
295 public NClob getNClob(int parameterIndex) throws SQLException { | |
296 throw newSQLFeatureNotSupportedException("getNClob"); | |
297 } | |
298 @Override | |
299 public NClob getNClob(String parameterName) throws SQLException { | |
300 throw newSQLFeatureNotSupportedException("getNClob"); | |
301 } | |
302 @Override | |
303 public String getNString(int parameterIndex) throws SQLException { | |
304 throw newSQLFeatureNotSupportedException("getNString"); | |
305 } | |
306 @Override | |
307 public String getNString(String parameterName) throws SQLException { | |
308 throw newSQLFeatureNotSupportedException("getNString"); | |
309 } | |
310 @Override | |
311 public Object getObject(int parameterIndex) throws SQLException { | |
312 throw newSQLFeatureNotSupportedException("getObject"); | |
313 } | |
314 @Override | |
315 public <T> T getObject(int parameterIndex, Class<T> type) throws SQLException { | |
316 throw newSQLFeatureNotSupportedException("getObject"); | |
317 } | |
318 @Override | |
319 public Object getObject(int parameterIndex, Map<String,Class<?>> map) throws SQLException { | |
320 throw newSQLFeatureNotSupportedException("getObject"); | |
321 } | |
322 @Override | |
323 public Object getObject(String parameterName) throws SQLException { | |
324 throw newSQLFeatureNotSupportedException("getObject"); | |
325 } | |
326 @Override | |
327 public <T> T getObject(String parameterName, Class<T> type) throws SQLException { | |
328 throw newSQLFeatureNotSupportedException("getObject"); | |
329 } | |
330 @Override | |
331 public Object getObject(String parameterName, Map<String,Class<?>> map) throws SQLException { | |
332 throw newSQLFeatureNotSupportedException("getObject"); | |
333 } | |
334 @Override | |
335 public Ref getRef(int parameterIndex) throws SQLException { | |
336 throw newSQLFeatureNotSupportedException("getRef"); | |
337 } | |
338 @Override | |
339 public Ref getRef(String parameterName) throws SQLException { | |
340 throw newSQLFeatureNotSupportedException("getRef"); | |
341 } | |
342 @Override | |
343 public RowId getRowId(int parameterIndex) throws SQLException { | |
344 throw newSQLFeatureNotSupportedException("getRowId"); | |
345 } | |
346 @Override | |
347 public RowId getRowId(String parameterName) throws SQLException { | |
348 throw newSQLFeatureNotSupportedException("getRowId"); | |
349 } | |
350 @Override | |
351 public short getShort(int parameterIndex) throws SQLException { | |
352 throw newSQLFeatureNotSupportedException("getShort"); | |
353 } | |
354 @Override | |
355 public short getShort(String parameterName) throws SQLException { | |
356 throw newSQLFeatureNotSupportedException("getShort"); | |
357 } | |
358 @Override | |
359 public SQLXML getSQLXML(int parameterIndex) throws SQLException { | |
360 throw newSQLFeatureNotSupportedException("getSQLXML"); | |
361 } | |
362 @Override | |
363 public SQLXML getSQLXML(String parameterName) throws SQLException { | |
364 throw newSQLFeatureNotSupportedException("getSQLXML"); | |
365 } | |
366 @Override | |
367 public String getString(int parameterIndex) throws SQLException { | |
368 throw newSQLFeatureNotSupportedException("getString"); | |
369 } | |
370 @Override | |
371 public String getString(String parameterName) throws SQLException { | |
372 throw newSQLFeatureNotSupportedException("getString"); | |
373 } | |
374 @Override | |
375 public Time getTime(int parameterIndex) throws SQLException { | |
376 throw newSQLFeatureNotSupportedException("getTime"); | |
377 } | |
378 @Override | |
379 public Time getTime(int parameterIndex, Calendar cal) throws SQLException { | |
380 throw newSQLFeatureNotSupportedException("getTime"); | |
381 } | |
382 @Override | |
383 public Time getTime(String parameterName) throws SQLException { | |
384 throw newSQLFeatureNotSupportedException("getTime"); | |
385 } | |
386 @Override | |
387 public Time getTime(String parameterName, Calendar cal) throws SQLException { | |
388 throw newSQLFeatureNotSupportedException("getTime"); | |
389 } | |
390 @Override | |
391 public Timestamp getTimestamp(int parameterIndex) throws SQLException { | |
392 throw newSQLFeatureNotSupportedException("getTimestamp"); | |
393 } | |
394 @Override | |
395 public Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException { | |
396 throw newSQLFeatureNotSupportedException("getTimestamp"); | |
397 } | |
398 @Override | |
399 public Timestamp getTimestamp(String parameterName) throws SQLException { | |
400 throw newSQLFeatureNotSupportedException("getTimestamp"); | |
401 } | |
402 @Override | |
403 public Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException { | |
404 throw newSQLFeatureNotSupportedException("getTimestamp"); | |
405 } | |
406 @Override | |
407 public URL getURL(int parameterIndex) throws SQLException { | |
408 throw newSQLFeatureNotSupportedException("getURL"); | |
409 } | |
410 @Override | |
411 public URL getURL(String parameterName) throws SQLException { | |
412 throw newSQLFeatureNotSupportedException("getURL"); | |
413 } | |
414 | |
415 | |
416 // all registerOutParameter(parameterIndex/parameterName, int sqlType, ...) methods are NOT supported | |
417 // because output parameters in stored procedures are not supported by MonetDB | |
418 @Override | |
419 public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException { | |
420 throw newSQLFeatureNotSupportedException("registerOutParameter"); | |
421 } | |
422 @Override | |
423 public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException { | |
424 throw newSQLFeatureNotSupportedException("registerOutParameter"); | |
425 } | |
426 @Override | |
427 public void registerOutParameter(int parameterIndex, int sqlType, String typeName) throws SQLException { | |
428 throw newSQLFeatureNotSupportedException("registerOutParameter"); | |
429 } | |
430 @Override | |
431 public void registerOutParameter(String parameterName, int sqlType) throws SQLException { | |
432 throw newSQLFeatureNotSupportedException("registerOutParameter"); | |
433 } | |
434 @Override | |
435 public void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException { | |
436 throw newSQLFeatureNotSupportedException("registerOutParameter"); | |
437 } | |
438 @Override | |
439 public void registerOutParameter(String parameterName, int sqlType, String typeName) throws SQLException { | |
440 throw newSQLFeatureNotSupportedException("registerOutParameter"); | |
441 } | |
442 | |
443 | |
444 // all setXyz(parameterName, ...) methods are mapped to setXyz(nameToIndex(parameterName), ...) methods | |
445 // this only works for parameter names "1", "2", "3", etc. | |
446 @Override | |
447 public void setAsciiStream(String parameterName, InputStream x) throws SQLException { | |
448 setAsciiStream(nameToIndex(parameterName), x); | |
449 } | |
450 @Override | |
451 public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException { | |
452 setAsciiStream(nameToIndex(parameterName), x, length); | |
453 } | |
454 @Override | |
455 public void setAsciiStream(String parameterName, InputStream x, long length) throws SQLException { | |
456 setAsciiStream(nameToIndex(parameterName), x, length); | |
457 } | |
458 @Override | |
459 public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException { | |
460 setBigDecimal(nameToIndex(parameterName), x); | |
461 } | |
462 @Override | |
463 public void setBinaryStream(String parameterName, InputStream x) throws SQLException { | |
464 setBinaryStream(nameToIndex(parameterName), x); | |
465 } | |
466 @Override | |
467 public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException { | |
468 setBinaryStream(nameToIndex(parameterName), x, length); | |
469 } | |
470 @Override | |
471 public void setBinaryStream(String parameterName, InputStream x, long length) throws SQLException { | |
472 setBinaryStream(nameToIndex(parameterName), x, length); | |
473 } | |
474 @Override | |
475 public void setBlob(String parameterName, Blob x) throws SQLException { | |
476 setBlob(nameToIndex(parameterName), x); | |
477 } | |
478 @Override | |
479 public void setBlob(String parameterName, InputStream inputStream) throws SQLException { | |
480 setBlob(nameToIndex(parameterName), inputStream); | |
481 } | |
482 @Override | |
483 public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException { | |
484 setBlob(nameToIndex(parameterName), inputStream, length); | |
485 } | |
486 @Override | |
487 public void setBoolean(String parameterName, boolean x) throws SQLException { | |
488 setBoolean(nameToIndex(parameterName), x); | |
489 } | |
490 @Override | |
491 public void setByte(String parameterName, byte x) throws SQLException { | |
492 setByte(nameToIndex(parameterName), x); | |
493 } | |
494 @Override | |
495 public void setBytes(String parameterName, byte[] x) throws SQLException { | |
496 setBytes(nameToIndex(parameterName), x); | |
497 } | |
498 @Override | |
499 public void setCharacterStream(String parameterName, Reader reader) throws SQLException { | |
500 setCharacterStream(nameToIndex(parameterName), reader); | |
501 } | |
502 @Override | |
503 public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException { | |
504 setCharacterStream(nameToIndex(parameterName), reader, length); | |
505 } | |
506 @Override | |
507 public void setCharacterStream(String parameterName, Reader reader, long length) throws SQLException { | |
508 setCharacterStream(nameToIndex(parameterName), reader, length); | |
509 } | |
510 @Override | |
511 public void setClob(String parameterName, Clob x) throws SQLException { | |
512 setClob(nameToIndex(parameterName), x); | |
513 } | |
514 @Override | |
515 public void setClob(String parameterName, Reader reader) throws SQLException { | |
516 setClob(nameToIndex(parameterName), reader); | |
517 } | |
518 @Override | |
519 public void setClob(String parameterName, Reader reader, long length) throws SQLException { | |
520 setClob(nameToIndex(parameterName), reader, length); | |
521 } | |
522 @Override | |
523 public void setDate(String parameterName, Date x) throws SQLException { | |
524 setDate(nameToIndex(parameterName), x); | |
525 } | |
526 @Override | |
527 public void setDate(String parameterName, Date x, Calendar cal) throws SQLException { | |
528 setDate(nameToIndex(parameterName), x, cal); | |
529 } | |
530 @Override | |
531 public void setDouble(String parameterName, double x) throws SQLException { | |
532 setDouble(nameToIndex(parameterName), x); | |
533 } | |
534 @Override | |
535 public void setFloat(String parameterName, float x) throws SQLException { | |
536 setFloat(nameToIndex(parameterName), x); | |
537 } | |
538 @Override | |
539 public void setInt(String parameterName, int x) throws SQLException { | |
540 setInt(nameToIndex(parameterName), x); | |
541 } | |
542 @Override | |
543 public void setLong(String parameterName, long x) throws SQLException { | |
544 setLong(nameToIndex(parameterName), x); | |
545 } | |
546 @Override | |
547 public void setNCharacterStream(String parameterName, Reader value) throws SQLException { | |
548 setNCharacterStream(nameToIndex(parameterName), value); | |
549 } | |
550 @Override | |
551 public void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException { | |
552 setNCharacterStream(nameToIndex(parameterName), value, length); | |
553 } | |
554 @Override | |
555 public void setNClob(String parameterName, NClob value) throws SQLException { | |
556 setNClob(nameToIndex(parameterName), value); | |
557 } | |
558 @Override | |
559 public void setNClob(String parameterName, Reader reader) throws SQLException { | |
560 setNClob(nameToIndex(parameterName), reader); | |
561 } | |
562 @Override | |
563 public void setNClob(String parameterName, Reader reader, long length) throws SQLException { | |
564 setNClob(nameToIndex(parameterName), reader, length); | |
565 } | |
566 @Override | |
567 public void setNString(String parameterName, String value) throws SQLException { | |
568 setNString(nameToIndex(parameterName), value); | |
569 } | |
570 @Override | |
571 public void setNull(String parameterName, int sqlType) throws SQLException { | |
572 setNull(nameToIndex(parameterName), sqlType); | |
573 } | |
574 @Override | |
575 public void setNull(String parameterName, int sqlType, String typeName) throws SQLException { | |
576 setNull(nameToIndex(parameterName), sqlType, typeName); | |
577 } | |
578 @Override | |
579 public void setObject(String parameterName, Object x) throws SQLException { | |
580 setObject(nameToIndex(parameterName), x); | |
581 } | |
582 @Override | |
583 public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException { | |
584 setObject(nameToIndex(parameterName), x, targetSqlType); | |
585 } | |
586 @Override | |
587 public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException { | |
588 setObject(nameToIndex(parameterName), x, targetSqlType, scale); | |
589 } | |
590 @Override | |
591 public void setRowId(String parameterName, RowId x) throws SQLException { | |
592 setRowId(nameToIndex(parameterName), x); | |
593 } | |
594 @Override | |
595 public void setShort(String parameterName, short x) throws SQLException { | |
596 setShort(nameToIndex(parameterName), x); | |
597 } | |
598 @Override | |
599 public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException { | |
600 setSQLXML(nameToIndex(parameterName), xmlObject); | |
601 } | |
602 @Override | |
603 public void setString(String parameterName, String x) throws SQLException { | |
604 setString(nameToIndex(parameterName), x); | |
605 } | |
606 @Override | |
607 public void setTime(String parameterName, Time x) throws SQLException { | |
608 setTime(nameToIndex(parameterName), x); | |
609 } | |
610 @Override | |
611 public void setTime(String parameterName, Time x, Calendar cal) throws SQLException { | |
612 setTime(nameToIndex(parameterName), x, cal); | |
613 } | |
614 @Override | |
615 public void setTimestamp(String parameterName, Timestamp x) throws SQLException { | |
616 setTimestamp(nameToIndex(parameterName), x); | |
617 } | |
618 @Override | |
619 public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException { | |
620 setTimestamp(nameToIndex(parameterName), x, cal); | |
621 } | |
622 @Override | |
623 public void setURL(String parameterName, URL val) throws SQLException { | |
624 setURL(nameToIndex(parameterName), val); | |
625 } | |
626 | |
627 /* Retrieves whether the last OUT parameter read had the value of SQL NULL. */ | |
628 @Override | |
629 public boolean wasNull() throws SQLException { | |
630 // wasNull() method is NOT supported | |
631 // because output parameters in stored procedures are not supported by MonetDB | |
632 throw newSQLFeatureNotSupportedException("wasNull"); | |
633 } | |
634 | |
635 //== Java 1.8 methods (JDBC 4.2) | |
636 | |
637 @Override | |
638 public void setObject(String parameterName, Object x, SQLType targetSqlType, int scaleOrLength) throws SQLException { | |
639 // setObject(nameToIndex(parameterName), x, convertSQLType(targetSqlType), scaleOrLength); // TODO implement convertSQLType(targetSqlType) | |
640 throw newSQLFeatureNotSupportedException("setObject"); | |
641 } | |
642 | |
643 @Override | |
644 public void setObject(String parameterName, Object x, SQLType targetSqlType) throws SQLException { | |
645 // setObject(nameToIndex(parameterName), x, convertSQLType(targetSqlType)); // TODO implement convertSQLType(targetSqlType) | |
646 throw newSQLFeatureNotSupportedException("setObject"); | |
647 } | |
648 | |
649 @Override | |
650 public void registerOutParameter(int parameterIndex, SQLType sqlType) throws SQLException { | |
651 throw newSQLFeatureNotSupportedException("registerOutParameter"); | |
652 } | |
653 @Override | |
654 public void registerOutParameter(int parameterIndex, SQLType sqlType, int scale) throws SQLException { | |
655 throw newSQLFeatureNotSupportedException("registerOutParameter"); | |
656 } | |
657 @Override | |
658 public void registerOutParameter(int parameterIndex, SQLType sqlType, String typeName) throws SQLException { | |
659 throw newSQLFeatureNotSupportedException("registerOutParameter"); | |
660 } | |
661 @Override | |
662 public void registerOutParameter(String parameterName, SQLType sqlType) throws SQLException { | |
663 throw newSQLFeatureNotSupportedException("registerOutParameter"); | |
664 } | |
665 @Override | |
666 public void registerOutParameter(String parameterName, SQLType sqlType, int scale) throws SQLException { | |
667 throw newSQLFeatureNotSupportedException("registerOutParameter"); | |
668 } | |
669 @Override | |
670 public void registerOutParameter(String parameterName, SQLType sqlType, String typeName) throws SQLException { | |
671 throw newSQLFeatureNotSupportedException("registerOutParameter"); | |
672 } | |
673 | |
674 // end methods interface CallableStatement | |
675 } |