annotate tests/Test_Wrapper.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 54137aeb1f92
children bf9f6b6ecf40
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
1 /*
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
2 * This Source Code Form is subject to the terms of the Mozilla Public
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
5 *
350
54137aeb1f92 Update Copyright year.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 261
diff changeset
6 * Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V.
18
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
7 */
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
8
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
9 import java.sql.*;
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
10
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
11 public class Test_Wrapper {
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
12 public static void main(String[] args) throws Exception {
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
13 final Connection con = DriverManager.getConnection(args[0]);
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
14 System.out.println("Connected. Auto commit is: " + con.getAutoCommit());
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
15
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
16 try {
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
17 final String jdbc_pkg = "java.sql.";
391
f523727db392 Moved Java classes from packages starting with nl.cwi.monetdb.* to package org.monetdb.*
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
18 final String monetdb_jdbc_pkg = "org.monetdb.jdbc.";
18
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
19
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
20 checkIsWrapperFor("Connection", con, jdbc_pkg, "Connection");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
21 checkIsWrapperFor("Connection", con, monetdb_jdbc_pkg, "MonetConnection");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
22 checkIsWrapperFor("Connection", con, jdbc_pkg, "Statement");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
23 checkIsWrapperFor("Connection", con, monetdb_jdbc_pkg, "MonetStatement");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
24
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
25 DatabaseMetaData dbmd = con.getMetaData();
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
26 checkIsWrapperFor("DatabaseMetaData", dbmd, jdbc_pkg, "DatabaseMetaData");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
27 checkIsWrapperFor("DatabaseMetaData", dbmd, monetdb_jdbc_pkg, "MonetDatabaseMetaData");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
28 checkIsWrapperFor("DatabaseMetaData", dbmd, jdbc_pkg, "Statement");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
29 checkIsWrapperFor("DatabaseMetaData", dbmd, monetdb_jdbc_pkg, "MonetStatement");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
30
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
31 ResultSet rs = dbmd.getSchemas();
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
32 checkIsWrapperFor("ResultSet", rs, jdbc_pkg, "ResultSet");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
33 checkIsWrapperFor("ResultSet", rs, monetdb_jdbc_pkg, "MonetResultSet");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
34 checkIsWrapperFor("ResultSet", rs, jdbc_pkg, "Statement");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
35 checkIsWrapperFor("ResultSet", rs, monetdb_jdbc_pkg, "MonetStatement");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
36
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
37 ResultSetMetaData rsmd = rs.getMetaData();
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
38 checkIsWrapperFor("ResultSetMetaData", rsmd, jdbc_pkg, "ResultSetMetaData");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
39 checkIsWrapperFor("ResultSetMetaData", rsmd, monetdb_jdbc_pkg, "MonetResultSet");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
40 checkIsWrapperFor("ResultSetMetaData", rsmd, monetdb_jdbc_pkg, "MonetResultSet$rsmdw"); // it is a private class of MonetResultSet
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
41 checkIsWrapperFor("ResultSetMetaData", rsmd, jdbc_pkg, "Statement");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
42 checkIsWrapperFor("ResultSetMetaData", rsmd, monetdb_jdbc_pkg, "MonetStatement");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
43
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
44 rs.close();
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
45
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
46 Statement stmt = con.createStatement();
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
47 checkIsWrapperFor("Statement", stmt, jdbc_pkg, "Statement");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
48 checkIsWrapperFor("Statement", stmt, monetdb_jdbc_pkg, "MonetStatement");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
49 checkIsWrapperFor("Statement", stmt, jdbc_pkg, "Connection");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
50 checkIsWrapperFor("Statement", stmt, monetdb_jdbc_pkg, "MonetConnection");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
51
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
52 stmt.close();
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
53
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
54 PreparedStatement pstmt = con.prepareStatement("SELECT name FROM sys.tables WHERE system AND name like ?");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
55 checkIsWrapperFor("PreparedStatement", pstmt, jdbc_pkg, "PreparedStatement");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
56 checkIsWrapperFor("PreparedStatement", pstmt, monetdb_jdbc_pkg, "MonetPreparedStatement");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
57 checkIsWrapperFor("PreparedStatement", pstmt, jdbc_pkg, "Statement");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
58 checkIsWrapperFor("PreparedStatement", pstmt, monetdb_jdbc_pkg, "MonetStatement");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
59 checkIsWrapperFor("PreparedStatement", pstmt, jdbc_pkg, "Connection");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
60 checkIsWrapperFor("PreparedStatement", pstmt, monetdb_jdbc_pkg, "MonetConnection");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
61
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
62 ParameterMetaData pmd = pstmt.getParameterMetaData();
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
63 checkIsWrapperFor("ParameterMetaData", pmd, jdbc_pkg, "ParameterMetaData");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
64 checkIsWrapperFor("ParameterMetaData", pmd, monetdb_jdbc_pkg, "MonetPreparedStatement");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
65 checkIsWrapperFor("ParameterMetaData", pmd, monetdb_jdbc_pkg, "MonetPreparedStatement$pmdw"); // it is a private class of MonetPreparedStatement
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
66 checkIsWrapperFor("ParameterMetaData", pmd, jdbc_pkg, "Connection");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
67 checkIsWrapperFor("ParameterMetaData", pmd, monetdb_jdbc_pkg, "MonetConnection");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
68
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
69 ResultSetMetaData psrsmd = pstmt.getMetaData();
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
70 checkIsWrapperFor("PrepStmt ResultSetMetaData", psrsmd, jdbc_pkg, "ResultSetMetaData");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
71 checkIsWrapperFor("PrepStmt ResultSetMetaData", psrsmd, monetdb_jdbc_pkg, "MonetPreparedStatement");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
72 checkIsWrapperFor("PrepStmt ResultSetMetaData", psrsmd, monetdb_jdbc_pkg, "MonetPreparedStatement$rsmdw"); // it is a private class of MonetPreparedStatement
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
73 checkIsWrapperFor("PrepStmt ResultSetMetaData", psrsmd, jdbc_pkg, "Connection");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
74 checkIsWrapperFor("PrepStmt ResultSetMetaData", psrsmd, monetdb_jdbc_pkg, "MonetConnection");
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
75
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
76 pstmt.close();
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
77
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
78 } catch (SQLException e) {
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
79 while ((e = e.getNextException()) != null)
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
80 System.out.println("FAILED :( " + e.getMessage());
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
81 }
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
82 con.close();
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
83 }
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
84
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
85 private static void checkIsWrapperFor(String objnm, Wrapper obj, String pkgnm, String classnm) {
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
86 try {
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
87 Class<?> clazz = Class.forName(pkgnm + classnm);
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
88 boolean isWrapper = obj.isWrapperFor(clazz);
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
89 System.out.print(objnm + ". isWrapperFor(" + classnm + ") returns: " + isWrapper);
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
90 if (isWrapper) {
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
91 Object wobj = obj.unwrap(clazz);
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
92 System.out.print("\tCalled unwrap(). Returned object is " + (wobj != null ? "not null, so oke" : "null !!"));
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
93 }
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
94 System.out.println();
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
95 } catch (ClassNotFoundException cnfe) {
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
96 System.out.println(cnfe.toString());
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
97 } catch (SQLException se) {
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
98 System.out.println(se.getMessage());
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
99 }
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
100 }
8e57d20b5e80 Corrected implementation of java.sql.Wrapper methods isWrapperFor() and unwrap().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
101 }