Mercurial > hg > monetdb-java
annotate tests/JDBC_API_Tester.java @ 436:b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Also extended and migrated test Bug_PrepStmtSetString_6382 to JDBC_API_Tester with no output on success.
author | Martin van Dinther <martin.van.dinther@monetdbsolutions.com> |
---|---|
date | Wed, 10 Feb 2021 17:51:12 +0100 (2021-02-10) |
parents | e79bfbd0553e |
children | 1333c19b0c1b |
rev | line source |
---|---|
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1 /* |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
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 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
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 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
5 * |
406
bf9f6b6ecf40
Update Copyright year.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
404
diff
changeset
|
6 * Copyright 1997 - July 2008 CWI, August 2008 - 2021 MonetDB B.V. |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
7 */ |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
8 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
9 import java.sql.*; |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
10 |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
11 import java.io.StringReader; |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
12 import java.nio.charset.Charset; |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
13 import java.text.SimpleDateFormat; |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
14 import java.util.ArrayList; |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
15 import java.util.Calendar; |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
16 import java.util.Iterator; |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
17 import java.util.List; |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
18 import java.util.TimeZone; |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
19 |
400
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
20 import org.monetdb.jdbc.types.INET; |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
21 import org.monetdb.jdbc.types.URL; |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
22 |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
23 /** |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
24 * class to test JDBC Driver API methods and behavior of MonetDB server. |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
25 * |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
26 * It combines 30+ tests which were previous individual test programs |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
27 * into one large test program, reusing the connection. |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
28 * This speeds up testing considerably as the overhead of starting a JVM and |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
29 * loading the java test program class and MonetDB JDBC driver is now reduced |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
30 * to only one time instead of 30+ times. |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
31 * Also all output is no longer send to system out/err but collected in a StringBuilder. |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
32 * The contents of it is compared with the expected output at the end of each test. |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
33 * Only when it deviates the output is sent to system out, see compareExpectedOutput(). |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
34 * |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
35 * @author Martin van Dinther |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
36 * @version 0.1 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
37 */ |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
38 final public class JDBC_API_Tester { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
39 StringBuilder sb; // buffer to collect the test output |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
40 final static int sbInitLen = 3416; |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
41 Connection con; // main connection shared by all tests |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
42 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
43 public static void main(String[] args) throws Exception { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
44 String con_URL = args[0]; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
45 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
46 JDBC_API_Tester jt = new JDBC_API_Tester(); |
400
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
47 jt.sb = new StringBuilder(sbInitLen); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
48 jt.con = DriverManager.getConnection(con_URL); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
49 // we are now connected |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
50 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
51 // run the tests |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
52 jt.Test_Cautocommit(con_URL); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
53 jt.Test_CisValid(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
54 jt.Test_Clargequery(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
55 jt.Test_Cmanycon(con_URL); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
56 jt.Test_Creplysize(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
57 jt.Test_Csavepoints(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
58 jt.Test_Ctransaction(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
59 jt.Test_Dobjects(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
60 jt.Test_FetchSize(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
61 jt.Test_PSgeneratedkeys(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
62 jt.Test_PSgetObject(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
63 jt.Test_PSlargebatchval(); |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
64 jt.Test_PSlargeresponse(con_URL); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
65 jt.Test_PSmanycon(con_URL); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
66 jt.Test_PSmetadata(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
67 jt.Test_PSsomeamount(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
68 jt.Test_PSsqldata(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
69 jt.Test_PStimedate(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
70 jt.Test_PStimezone(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
71 jt.Test_PStypes(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
72 jt.Test_CallableStmt(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
73 jt.Test_Rbooleans(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
74 jt.Test_Rmetadata(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
75 jt.Test_Rpositioning(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
76 jt.Test_Rsqldata(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
77 jt.Test_Rtimedate(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
78 jt.Test_Sbatching(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
79 jt.Test_Smoreresults(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
80 jt.Test_Wrapper(); |
436
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
81 jt.Bug_PrepStmtSetString_6382(); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
82 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
83 jt.closeConx(jt.con); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
84 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
85 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
86 private void Test_Cautocommit(String arg0) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
87 sb.setLength(0); // clear the output log buffer |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
88 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
89 Connection con1 = con; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
90 Connection con2 = null; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
91 Statement stmt1 = null; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
92 Statement stmt2 = null; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
93 ResultSet rs = null; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
94 try { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
95 con2 = DriverManager.getConnection(arg0); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
96 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
97 // >> true: auto commit should be on by default |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
98 if (con1.getAutoCommit() != true) |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
99 sb.append("expecting con1 to have autocommit on/true"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
100 if (con2.getAutoCommit() != true) |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
101 sb.append("expecting con2 to have autocommit on/true"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
102 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
103 // test commit by checking if a change is visible in another connection |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
104 stmt1 = con1.createStatement(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
105 sb.append("1. create..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
106 stmt1.executeUpdate("CREATE TABLE table_Test_Cautocommit ( id int )"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
107 sb.append("passed :)\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
108 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
109 stmt2 = con2.createStatement(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
110 sb.append("2. select..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
111 rs = stmt2.executeQuery("SELECT * FROM table_Test_Cautocommit"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
112 sb.append("passed :)\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
113 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
114 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
115 closeStmtResSet(stmt2, rs); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
116 closeStmtResSet(stmt1, null); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
117 closeConx(con2); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
118 sb.append("ABORTING TEST!!!"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
119 return; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
120 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
121 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
122 try { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
123 // turn off auto commit |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
124 con1.setAutoCommit(false); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
125 con2.setAutoCommit(false); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
126 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
127 // >> false: we just disabled it |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
128 if (con1.getAutoCommit() != false) |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
129 sb.append("expecting con1 to have autocommit off/false"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
130 if (con2.getAutoCommit() != false) |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
131 sb.append("expecting con2 to have autocommit off/false"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
132 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
133 // a change would not be visible now |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
134 sb.append("3. drop..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
135 stmt2.executeUpdate("DROP TABLE table_Test_Cautocommit"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
136 sb.append("passed :)\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
137 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
138 sb.append("4. select..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
139 rs = stmt1.executeQuery("SELECT * FROM table_Test_Cautocommit"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
140 sb.append("passed :)\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
141 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
142 sb.append("5. commit..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
143 con2.commit(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
144 sb.append("passed :)\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
145 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
146 sb.append("6. select..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
147 rs = stmt1.executeQuery("SELECT * FROM table_Test_Cautocommit"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
148 sb.append("passed :)\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
149 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
150 sb.append("7. commit..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
151 con1.commit(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
152 sb.append("passed :)\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
153 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
154 // restore original auto commit setting |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
155 con1.setAutoCommit(true); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
156 con2.setAutoCommit(true); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
157 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
158 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
159 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
160 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
161 closeStmtResSet(stmt1, rs); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
162 closeStmtResSet(stmt2, null); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
163 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
164 closeConx(con2); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
165 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
166 compareExpectedOutput("Test_Cautocommit", |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
167 "1. create...passed :)\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
168 "2. select...passed :)\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
169 "3. drop...passed :)\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
170 "4. select...passed :)\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
171 "5. commit...passed :)\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
172 "6. select...passed :)\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
173 "7. commit...passed :)\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
174 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
175 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
176 private void Test_CisValid() { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
177 sb.setLength(0); // clear the output log buffer |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
178 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
179 Statement stmt = null; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
180 try { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
181 stmt = con.createStatement(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
182 con.setAutoCommit(false); // start a transaction |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
183 stmt.executeQuery("SELECT COUNT(*) FROM doesnotexist;"); // let's trigger an error |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
184 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
185 // e.printStackTrace(); |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
186 sb.append("Expected error: ").append(e).append("\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
187 try { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
188 // test calling conn.isValid() |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
189 sb.append("Validating connection: con.isValid? ").append(con.isValid(30)); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
190 // Can we rollback on this connection without causing an error? |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
191 con.rollback(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
192 } catch (SQLException e2) { |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
193 sb.append("UnExpected error: ").append(e2); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
194 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
195 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
196 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
197 try { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
198 // restore auto commit mode |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
199 con.setAutoCommit(true); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
200 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
201 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
202 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
203 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
204 closeStmtResSet(stmt, null); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
205 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
206 compareExpectedOutput("Test_CisValid", |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
207 "Expected error: java.sql.SQLException: SELECT: no such table 'doesnotexist'\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
208 "Validating connection: con.isValid? true"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
209 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
210 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
211 private void Test_Clargequery() { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
212 sb.setLength(0); // clear the output log buffer |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
213 final String query = |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
214 "-- When a query larger than the send buffer is being " + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
215 "sent, a deadlock situation can occur when the server writes " + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
216 "data back, blocking because we as client are sending as well " + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
217 "and not reading. Hence, to avoid this deadlock, in JDBC a " + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
218 "separate thread is started in the background such that results " + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
219 "from the server can be read, while data is still being sent to " + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
220 "the server. To test this, we need to trigger the SendThread " + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
221 "being started, which we do with a quite large query. We " + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
222 "construct it by repeating some stupid query plus a comment " + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
223 "a lot of times. And as you're guessing by now, you're reading " + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
224 "this stupid comment that we use :)\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
225 "select 1;\n"; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
226 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
227 final int size = 1234; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
228 StringBuilder bigq = new StringBuilder(query.length() * size); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
229 for (int i = 0; i < size; i++) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
230 bigq.append(query); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
231 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
232 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
233 Statement stmt = null; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
234 try { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
235 // >> true: auto commit should be on by default |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
236 sb.append("0. true\t").append(con.getAutoCommit()).append("\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
237 stmt = con.createStatement(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
238 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
239 // sending big script with many simple queries |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
240 sb.append("1. executing script").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
241 stmt.execute(bigq.toString()); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
242 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
243 int i = 1; // we skip the first "getResultSet()" |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
244 while (stmt.getMoreResults() != false) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
245 i++; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
246 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
247 if (stmt.getUpdateCount() != -1) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
248 sb.append("Error: found an update count for a SELECT query").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
249 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
250 if (i != size) { |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
251 sb.append("Error: expecting ").append(size).append(" tuples, only got ").append(i).append("\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
252 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
253 sb.append("2. queries processed").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
254 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
255 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
256 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
257 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
258 closeStmtResSet(stmt, null); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
259 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
260 compareExpectedOutput("Test_Clargequery", |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
261 "0. true true\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
262 "1. executing script\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
263 "2. queries processed\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
264 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
265 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
266 private void Test_Cmanycon(String arg0) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
267 sb.setLength(0); // clear the output log buffer |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
268 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
269 final int maxCons = 60; // default max_clients is 64, 2 connections are already open from this program |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
270 List<Connection> cons = new ArrayList<Connection>(maxCons); // Connections go in here |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
271 try { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
272 // spawn a lot of Connections, just for fun... |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
273 int i = 1; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
274 sb.append("Establishing Connection "); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
275 for (; i <= maxCons; i++) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
276 sb.append(i); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
277 Connection conx = DriverManager.getConnection(arg0); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
278 sb.append(","); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
279 cons.add(conx); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
280 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
281 // do something with the connection to test if it works |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
282 conx.setAutoCommit(false); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
283 sb.append(" "); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
284 conx.createStatement(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
285 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
286 sb.append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
287 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
288 // now try to nicely close them |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
289 i = 1; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
290 sb.append("Closing Connection "); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
291 for (Iterator<Connection> it = cons.iterator(); it.hasNext(); i++) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
292 Connection conx = it.next(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
293 // see if the connection still works |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
294 sb.append(i); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
295 conx.setAutoCommit(true); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
296 sb.append(","); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
297 conx.close(); // this will also implicitly close the created statement object |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
298 sb.append(" "); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
299 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
300 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
301 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
302 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
303 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
304 compareExpectedOutput("Test_Cmanycon", |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
305 "Establishing Connection 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, " + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
306 "11, 12, 13, 14, 15, 16, 17, 18, 19, 20, " + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
307 "21, 22, 23, 24, 25, 26, 27, 28, 29, 30, " + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
308 "31, 32, 33, 34, 35, 36, 37, 38, 39, 40, " + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
309 "41, 42, 43, 44, 45, 46, 47, 48, 49, 50, " + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
310 "51, 52, 53, 54, 55, 56, 57, 58, 59, 60, \n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
311 "Closing Connection 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, " + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
312 "11, 12, 13, 14, 15, 16, 17, 18, 19, 20, " + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
313 "21, 22, 23, 24, 25, 26, 27, 28, 29, 30, " + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
314 "31, 32, 33, 34, 35, 36, 37, 38, 39, 40, " + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
315 "41, 42, 43, 44, 45, 46, 47, 48, 49, 50, " + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
316 "51, 52, 53, 54, 55, 56, 57, 58, 59, 60, "); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
317 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
318 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
319 private void Test_Creplysize() { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
320 sb.setLength(0); // clear the output log buffer |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
321 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
322 Statement stmt1 = null; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
323 ResultSet rs = null; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
324 try { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
325 con.setAutoCommit(false); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
326 // >> true: auto commit should be off by now |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
327 sb.append("0. true\t").append(con.getAutoCommit()).append("\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
328 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
329 stmt1 = con.createStatement(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
330 // test commit by checking if a change is visible in another connection |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
331 sb.append("1. create... "); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
332 stmt1.executeUpdate("CREATE TABLE table_Test_Creplysize ( id int )"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
333 sb.append("passed").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
334 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
335 sb.append("2. populating with 21 records... "); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
336 for (int i = 0; i < 21; i++) |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
337 stmt1.executeUpdate("INSERT INTO table_Test_Creplysize (id) values (" + (i + 1) + ")"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
338 sb.append("passed").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
339 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
340 sb.append("3. hinting the driver to use fetchsize 10... "); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
341 stmt1.setFetchSize(10); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
342 sb.append("passed").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
343 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
344 sb.append("4. selecting all values... "); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
345 rs = stmt1.executeQuery("SELECT * FROM table_Test_Creplysize"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
346 int i = 0; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
347 while (rs.next()) |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
348 i++; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
349 rs.close(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
350 if (i == 21) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
351 sb.append("passed"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
352 } else { |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
353 sb.append("got ").append(i).append(" records!!!"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
354 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
355 sb.append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
356 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
357 sb.append("5. resetting driver fetchsize hint... "); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
358 stmt1.setFetchSize(0); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
359 sb.append("passed").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
360 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
361 sb.append("6. instructing the driver to return at max 10 rows... "); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
362 stmt1.setMaxRows(10); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
363 sb.append("passed").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
364 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
365 sb.append("7. selecting all values... "); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
366 rs = stmt1.executeQuery("SELECT * FROM table_Test_Creplysize"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
367 i = 0; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
368 while (rs.next()) |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
369 i++; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
370 rs.close(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
371 if (i == 10) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
372 sb.append("passed"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
373 } else { |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
374 sb.append("got ").append(i).append(" records!!!"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
375 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
376 sb.append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
377 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
378 sb.append("8. hinting the driver to use fetchsize 5... "); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
379 stmt1.setFetchSize(5); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
380 sb.append("passed").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
381 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
382 sb.append("9. selecting all values... "); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
383 rs = stmt1.executeQuery("SELECT * FROM table_Test_Creplysize"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
384 i = 0; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
385 while (rs.next()) |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
386 i++; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
387 rs.close(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
388 if (i == 10) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
389 sb.append("passed"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
390 } else { |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
391 sb.append("got ").append(i).append(" records!!!"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
392 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
393 sb.append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
394 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
395 sb.append("10. drop... "); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
396 stmt1.executeUpdate("DROP TABLE table_Test_Creplysize"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
397 sb.append("passed").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
398 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
399 con.rollback(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
400 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
401 // restore auto commit mode |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
402 con.setAutoCommit(true); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
403 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
404 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
405 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
406 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
407 closeStmtResSet(stmt1, rs); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
408 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
409 compareExpectedOutput("Test_Creplysize", |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
410 "0. true false\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
411 "1. create... passed\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
412 "2. populating with 21 records... passed\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
413 "3. hinting the driver to use fetchsize 10... passed\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
414 "4. selecting all values... passed\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
415 "5. resetting driver fetchsize hint... passed\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
416 "6. instructing the driver to return at max 10 rows... passed\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
417 "7. selecting all values... passed\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
418 "8. hinting the driver to use fetchsize 5... passed\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
419 "9. selecting all values... passed\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
420 "10. drop... passed\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
421 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
422 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
423 private void Test_Csavepoints() { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
424 sb.setLength(0); // clear the output log buffer |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
425 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
426 Statement stmt = null; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
427 ResultSet rs = null; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
428 try { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
429 // >> true: auto commit should be on by default |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
430 sb.append("0. true\t").append(con.getAutoCommit()).append("\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
431 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
432 // savepoints require a non-autocommit connection |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
433 try { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
434 sb.append("1. savepoint..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
435 con.setSavepoint(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
436 sb.append("passed !!"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
437 } catch (SQLException e) { |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
438 sb.append("expected msg: ").append(e.getMessage()); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
439 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
440 sb.append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
441 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
442 con.setAutoCommit(false); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
443 // >> true: auto commit should be on by default |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
444 sb.append("0. false\t").append(con.getAutoCommit()).append("\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
445 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
446 sb.append("2. savepoint..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
447 /* make a savepoint, and discard it */ |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
448 con.setSavepoint(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
449 sb.append("passed").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
450 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
451 stmt = con.createStatement(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
452 stmt.executeUpdate("CREATE TABLE table_Test_Csavepoints ( id int, PRIMARY KEY (id) )"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
453 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
454 sb.append("3. savepoint..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
455 Savepoint sp2 = con.setSavepoint("empty table"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
456 sb.append("passed").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
457 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
458 rs = stmt.executeQuery("SELECT id FROM table_Test_Csavepoints"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
459 int i = 0; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
460 int items = 0; |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
461 sb.append("4. table ").append(items).append(" items"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
462 while (rs.next()) { |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
463 sb.append(", ").append(rs.getString("id")); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
464 i++; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
465 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
466 if (i != items) { |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
467 sb.append(" FAILED (").append(i).append(")"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
468 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
469 sb.append(" passed").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
470 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
471 stmt.executeUpdate("INSERT INTO table_Test_Csavepoints VALUES (1)"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
472 stmt.executeUpdate("INSERT INTO table_Test_Csavepoints VALUES (2)"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
473 stmt.executeUpdate("INSERT INTO table_Test_Csavepoints VALUES (3)"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
474 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
475 sb.append("5. savepoint..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
476 Savepoint sp3 = con.setSavepoint("three values"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
477 sb.append("passed").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
478 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
479 rs = stmt.executeQuery("SELECT id FROM table_Test_Csavepoints"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
480 i = 0; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
481 items = 3; |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
482 sb.append("6. table ").append(items).append(" items"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
483 while (rs.next()) { |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
484 sb.append(", ").append(rs.getString("id")); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
485 i++; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
486 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
487 if (i != items) { |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
488 sb.append(" FAILED (").append(i).append(")"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
489 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
490 sb.append(" passed").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
491 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
492 sb.append("7. release..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
493 con.releaseSavepoint(sp3); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
494 sb.append("passed").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
495 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
496 rs = stmt.executeQuery("SELECT id FROM table_Test_Csavepoints"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
497 i = 0; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
498 items = 3; |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
499 sb.append("8. table ").append(items).append(" items"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
500 while (rs.next()) { |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
501 sb.append(", ").append(rs.getString("id")); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
502 i++; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
503 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
504 if (i != items) { |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
505 sb.append(" FAILED (").append(i).append(") :("); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
506 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
507 sb.append(" passed").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
508 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
509 sb.append("9. rollback..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
510 con.rollback(sp2); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
511 sb.append("passed").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
512 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
513 rs = stmt.executeQuery("SELECT id FROM table_Test_Csavepoints"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
514 i = 0; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
515 items = 0; |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
516 sb.append("10. table ").append(items).append(" items"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
517 while (rs.next()) { |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
518 sb.append(", ").append(rs.getString("id")); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
519 i++; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
520 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
521 if (i != items) { |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
522 sb.append(" FAILED (").append(i).append(") :("); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
523 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
524 sb.append(" passed"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
525 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
526 con.rollback(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
527 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
528 // restore auto commit mode |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
529 con.setAutoCommit(true); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
530 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
531 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
532 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
533 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
534 closeStmtResSet(stmt, rs); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
535 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
536 compareExpectedOutput("Test_Csavepoints", |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
537 "0. true true\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
538 "1. savepoint...expected msg: SAVEPOINT: not allowed in auto commit mode\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
539 "0. false false\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
540 "2. savepoint...passed\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
541 "3. savepoint...passed\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
542 "4. table 0 items passed\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
543 "5. savepoint...passed\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
544 "6. table 3 items, 1, 2, 3 passed\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
545 "7. release...passed\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
546 "8. table 3 items, 1, 2, 3 passed\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
547 "9. rollback...passed\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
548 "10. table 0 items passed"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
549 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
550 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
551 private void Test_Ctransaction() { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
552 sb.setLength(0); // clear the output log buffer |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
553 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
554 try { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
555 // test commit by checking if a change is visible in another connection |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
556 sb.append("1. commit..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
557 con.commit(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
558 sb.append("passed"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
559 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
560 // this means we get what we expect |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
561 sb.append("failed as expected: ").append(e.getMessage()); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
562 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
563 sb.append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
564 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
565 try { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
566 // turn off auto commit |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
567 con.setAutoCommit(false); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
568 // >> false: we just disabled it |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
569 sb.append("2. false\t").append(con.getAutoCommit()).append("\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
570 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
571 // a change would not be visible now |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
572 sb.append("3. commit..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
573 con.commit(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
574 sb.append("passed").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
575 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
576 sb.append("4. commit..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
577 con.commit(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
578 sb.append("passed").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
579 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
580 sb.append("5. rollback..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
581 con.rollback(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
582 sb.append("passed"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
583 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
584 sb.append("FAILED: ").append(e.getMessage()); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
585 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
586 sb.append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
587 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
588 Statement stmt = null; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
589 try { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
590 // turn off auto commit |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
591 con.setAutoCommit(true); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
592 // >> false: we just disabled it |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
593 sb.append("6. true\t").append(con.getAutoCommit()).append("\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
594 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
595 stmt = con.createStatement(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
596 sb.append("7. start transaction..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
597 stmt.executeUpdate("START TRANSACTION"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
598 sb.append("passed").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
599 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
600 sb.append("8. commit..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
601 con.commit(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
602 sb.append("passed").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
603 |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
604 sb.append("9. true\t").append(con.getAutoCommit()); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
605 sb.append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
606 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
607 sb.append("10. start transaction..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
608 stmt.executeUpdate("START TRANSACTION"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
609 sb.append("passed").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
610 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
611 sb.append("11. rollback..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
612 con.rollback(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
613 sb.append("passed").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
614 |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
615 sb.append("12. true\t").append(con.getAutoCommit()); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
616 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
617 sb.append("FAILED: ").append(e.getMessage()); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
618 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
619 sb.append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
620 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
621 try { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
622 // a commit now should fail |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
623 sb.append("13. commit..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
624 con.commit(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
625 sb.append("passed"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
626 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
627 // this means we get what we expect |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
628 sb.append("failed as expected: ").append(e.getMessage()); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
629 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
630 sb.append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
631 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
632 closeStmtResSet(stmt, null); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
633 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
634 compareExpectedOutput("Test_Ctransaction", |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
635 "1. commit...failed as expected: COMMIT: not allowed in auto commit mode\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
636 "2. false false\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
637 "3. commit...passed\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
638 "4. commit...passed\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
639 "5. rollback...passed\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
640 "6. true true\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
641 "7. start transaction...passed\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
642 "8. commit...passed\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
643 "9. true true\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
644 "10. start transaction...passed\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
645 "11. rollback...passed\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
646 "12. true true\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
647 "13. commit...failed as expected: COMMIT: not allowed in auto commit mode\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
648 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
649 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
650 private void Test_Dobjects() { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
651 sb.setLength(0); // clear the output log buffer |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
652 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
653 try { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
654 DatabaseMetaData dbmd = con.getMetaData(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
655 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
656 // inspect the catalog by use of dbmd functions |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
657 compareResultSet(dbmd.getCatalogs(), "getCatalogs()", |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
658 "Resultset with 1 columns\n" + |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
659 "TABLE_CAT\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
660 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
661 compareResultSet(dbmd.getSchemas(null, "sys"), "getSchemas(null, sys)", |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
662 "Resultset with 2 columns\n" + |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
663 "TABLE_SCHEM TABLE_CATALOG\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
664 "sys null\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
665 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
666 compareResultSet(dbmd.getTables(null, "tmp", null, null), "getTables(null, tmp, null, null)", // schema tmp has 6 tables |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
667 "Resultset with 10 columns\n" + |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
668 "TABLE_CAT TABLE_SCHEM TABLE_NAME TABLE_TYPE REMARKS TYPE_CAT TYPE_SCHEM TYPE_NAME SELF_REFERENCING_COL_NAME REF_GENERATION\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
669 "null tmp _columns SYSTEM TABLE null null null null null null\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
670 "null tmp _tables SYSTEM TABLE null null null null null null\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
671 "null tmp idxs SYSTEM TABLE null null null null null null\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
672 "null tmp keys SYSTEM TABLE null null null null null null\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
673 "null tmp objects SYSTEM TABLE null null null null null null\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
674 "null tmp triggers SYSTEM TABLE null null null null null null\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
675 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
676 compareResultSet(dbmd.getTables(null, "sys", "schemas", null), "getTables(null, sys, schemas, null)", |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
677 "Resultset with 10 columns\n" + |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
678 "TABLE_CAT TABLE_SCHEM TABLE_NAME TABLE_TYPE REMARKS TYPE_CAT TYPE_SCHEM TYPE_NAME SELF_REFERENCING_COL_NAME REF_GENERATION\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
679 "null sys schemas SYSTEM TABLE null null null null null null\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
680 |
427
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
681 compareResultSet(dbmd.getColumns(null, "sys", "table\\_types", null), "getColumns(null, sys, table\\_types, null)", |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
682 "Resultset with 24 columns\n" + |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
683 "TABLE_CAT TABLE_SCHEM TABLE_NAME COLUMN_NAME DATA_TYPE TYPE_NAME COLUMN_SIZE BUFFER_LENGTH DECIMAL_DIGITS NUM_PREC_RADIX NULLABLE REMARKS COLUMN_DEF SQL_DATA_TYPE SQL_DATETIME_SUB CHAR_OCTET_LENGTH ORDINAL_POSITION IS_NULLABLE SCOPE_CATALOG SCOPE_SCHEMA SCOPE_TABLE SOURCE_DATA_TYPE IS_AUTOINCREMENT IS_GENERATEDCOLUMN\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
684 "null sys table_types table_type_id 5 smallint 16 0 0 2 0 null null 0 0 null 1 NO null null null null NO NO\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
685 "null sys table_types table_type_name 12 varchar 25 0 0 0 0 null null 0 0 25 2 NO null null null null NO NO\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
686 |
427
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
687 compareResultSet(dbmd.getPrimaryKeys(null, "sys", "table\\_types"), "getPrimaryKeys(null, sys, table\\_types)", |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
688 "Resultset with 6 columns\n" + |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
689 "TABLE_CAT TABLE_SCHEM TABLE_NAME COLUMN_NAME KEY_SEQ PK_NAME\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
690 "null sys table_types table_type_id 1 table_types_table_type_id_pkey\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
691 |
427
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
692 compareResultSet(dbmd.getExportedKeys(null, "sys", "table\\_types"), "getExportedKeys(null, sys, table\\_types)", |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
693 "Resultset with 14 columns\n" + |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
694 "PKTABLE_CAT PKTABLE_SCHEM PKTABLE_NAME PKCOLUMN_NAME FKTABLE_CAT FKTABLE_SCHEM FKTABLE_NAME FKCOLUMN_NAME KEY_SEQ UPDATE_RULE DELETE_RULE FK_NAME PK_NAME DEFERRABILITY\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
695 |
427
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
696 compareResultSet(dbmd.getCrossReference(null, "sys", "tables", null, "sys", "table\\_types"), "getCrossReference(null, sys, tables, null, sys, table\\_types)", |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
697 "Resultset with 14 columns\n" + |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
698 "PKTABLE_CAT PKTABLE_SCHEM PKTABLE_NAME PKCOLUMN_NAME FKTABLE_CAT FKTABLE_SCHEM FKTABLE_NAME FKCOLUMN_NAME KEY_SEQ UPDATE_RULE DELETE_RULE FK_NAME PK_NAME DEFERRABILITY\n"); |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
699 |
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
700 compareResultSet(dbmd.getImportedKeys(null, "sys", "table\\_types"), "getImportedKeys(null, sys, table\\_types)", |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
701 "Resultset with 14 columns\n" + |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
702 "PKTABLE_CAT PKTABLE_SCHEM PKTABLE_NAME PKCOLUMN_NAME FKTABLE_CAT FKTABLE_SCHEM FKTABLE_NAME FKCOLUMN_NAME KEY_SEQ UPDATE_RULE DELETE_RULE FK_NAME PK_NAME DEFERRABILITY\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
703 |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
704 compareResultSet(dbmd.getIndexInfo(null, "sys", "key_types", false, false), "getIndexInfo(null, sys, key_types, false, false)", |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
705 "Resultset with 13 columns\n" + |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
706 "TABLE_CAT TABLE_SCHEM TABLE_NAME NON_UNIQUE INDEX_QUALIFIER INDEX_NAME TYPE ORDINAL_POSITION COLUMN_NAME ASC_OR_DESC CARDINALITY PAGES FILTER_CONDITION\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
707 "null sys key_types false null key_types_key_type_id_pkey 2 1 key_type_id null 3 0 null\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
708 "null sys key_types false null key_types_key_type_name_unique 2 1 key_type_name null 3 0 null\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
709 |
427
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
710 compareResultSet(dbmd.getTablePrivileges(null, "sys", "table\\_types"), "getTablePrivileges(null, sys, table\\_types)", |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
711 "Resultset with 7 columns\n" + |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
712 "TABLE_CAT TABLE_SCHEM TABLE_NAME GRANTOR GRANTEE PRIVILEGE IS_GRANTABLE\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
713 "null sys table_types monetdb public SELECT NO\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
714 |
427
e79bfbd0553e
Added support for escaped wildcards (\% en \_) in String arguments of
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
406
diff
changeset
|
715 compareResultSet(dbmd.getColumnPrivileges(null, "sys", "table\\_types", null), "getColumnPrivileges(null, sys, table\\_types, null)", |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
716 "Resultset with 8 columns\n" + |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
717 "TABLE_CAT TABLE_SCHEM TABLE_NAME COLUMN_NAME GRANTOR GRANTEE PRIVILEGE IS_GRANTABLE\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
718 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
719 compareResultSet(dbmd.getUDTs(null, "sys", null, null), "getUDTs(null, sys, null, null)", |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
720 "Resultset with 7 columns\n" + |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
721 "TYPE_CAT TYPE_SCHEM TYPE_NAME CLASS_NAME DATA_TYPE REMARKS BASE_TYPE\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
722 "null sys inet org.monetdb.jdbc.types.INET 2000 inet null\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
723 "null sys json java.lang.String 2000 json null\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
724 "null sys url org.monetdb.jdbc.types.URL 2000 url null\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
725 "null sys uuid java.lang.String 2000 uuid null\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
726 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
727 int[] UDTtypes = { Types.STRUCT, Types.DISTINCT }; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
728 compareResultSet(dbmd.getUDTs(null, "sys", null, UDTtypes), "getUDTs(null, sys, null, UDTtypes", |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
729 "Resultset with 7 columns\n" + |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
730 "TYPE_CAT TYPE_SCHEM TYPE_NAME CLASS_NAME DATA_TYPE REMARKS BASE_TYPE\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
731 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
732 sb.setLength(0); // clear the output log buffer |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
733 } catch (SQLException e) { |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
734 sb.setLength(0); // clear the output log buffer |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
735 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
736 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
737 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
738 compareExpectedOutput("Test_Dobjects", ""); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
739 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
740 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
741 private void compareResultSet(ResultSet rs, String methodnm, String expected) throws SQLException { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
742 sb.setLength(0); // clear the output log buffer |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
743 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
744 ResultSetMetaData rsmd = rs.getMetaData(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
745 int columnCount = rsmd.getColumnCount(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
746 sb.append("Resultset with ").append(columnCount).append(" columns").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
747 for (int col = 1; col <= columnCount; col++) { |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
748 if (col > 1) |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
749 sb.append("\t"); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
750 sb.append(rsmd.getColumnName(col)); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
751 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
752 sb.append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
753 while (rs.next()) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
754 for (int col = 1; col <= columnCount; col++) { |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
755 if (col > 1) |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
756 sb.append("\t"); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
757 sb.append(rs.getString(col)); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
758 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
759 sb.append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
760 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
761 rs.close(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
762 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
763 compareExpectedOutput(methodnm, expected); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
764 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
765 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
766 private void Test_FetchSize() { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
767 sb.setLength(0); // clear the output log buffer |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
768 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
769 Statement stmt = null; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
770 ResultSet rs = null; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
771 try { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
772 stmt = con.createStatement(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
773 rs = stmt.executeQuery("SELECT * FROM _tables"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
774 |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
775 sb.append("Statement fetch size before set: ").append(stmt.getFetchSize()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
776 sb.append("ResultSet fetch size before set: ").append(rs.getFetchSize()).append("\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
777 |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
778 stmt.setFetchSize(40); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
779 rs.setFetchSize(16384); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
780 |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
781 sb.append("Statement fetch size after set: ").append(stmt.getFetchSize()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
782 sb.append("ResultSet fetch size after set: ").append(rs.getFetchSize()).append("\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
783 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
784 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
785 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
786 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
787 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
788 closeStmtResSet(stmt, rs); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
789 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
790 compareExpectedOutput("Test_FetchSize", |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
791 "Statement fetch size before set: 0\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
792 "ResultSet fetch size before set: 250\n" + |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
793 "Statement fetch size after set: 40\n" + |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
794 "ResultSet fetch size after set: 16384\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
795 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
796 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
797 private void Test_PSgeneratedkeys() { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
798 sb.setLength(0); // clear the output log buffer |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
799 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
800 Statement stmt = null; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
801 try { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
802 con.setAutoCommit(false); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
803 // >> false: auto commit was just switched off |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
804 sb.append("0. false\t").append(con.getAutoCommit()).append("\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
805 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
806 stmt = con.createStatement(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
807 stmt.executeUpdate( |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
808 "CREATE TABLE psgenkey (" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
809 " id serial," + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
810 " val varchar(20)" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
811 ")"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
812 stmt.close(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
813 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
814 sb.append("FAILED to CREATE TABLE psgenkey: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
815 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
816 closeStmtResSet(stmt, null); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
817 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
818 PreparedStatement pstmt = null; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
819 ResultSet keys = null; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
820 try { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
821 pstmt = con.prepareStatement( |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
822 "INSERT INTO psgenkey (val) VALUES ('this is a test')", |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
823 Statement.RETURN_GENERATED_KEYS); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
824 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
825 sb.append("1. inserting 3 records..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
826 pstmt.executeUpdate(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
827 pstmt.executeUpdate(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
828 pstmt.executeUpdate(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
829 sb.append("success").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
830 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
831 // now get the generated keys |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
832 sb.append("2. getting generated keys..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
833 keys = pstmt.getGeneratedKeys(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
834 if (keys == null) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
835 sb.append("there are no keys!").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
836 } else { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
837 while (keys.next()) { |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
838 sb.append("generated key index: ").append(keys.getInt(1)).append("\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
839 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
840 if (keys.getStatement() == null) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
841 sb.append("ResultSet.getStatement() should never return null!").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
842 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
843 keys.close(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
844 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
845 pstmt.close(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
846 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
847 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
848 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
849 closeStmtResSet(pstmt, keys); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
850 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
851 try { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
852 con.rollback(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
853 // restore default setting |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
854 con.setAutoCommit(true); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
855 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
856 sb.append("FAILED to rollback: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
857 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
858 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
859 compareExpectedOutput("Test_PSgeneratedkeys", |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
860 "0. false false\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
861 "1. inserting 3 records...success\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
862 "2. getting generated keys...generated key index: 3\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
863 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
864 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
865 private void Test_PSgetObject() { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
866 sb.setLength(0); // clear the output log buffer |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
867 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
868 Statement stmt = null; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
869 try { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
870 con.setAutoCommit(false); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
871 // >> false: auto commit was just switched off |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
872 sb.append("0. false\t").append(con.getAutoCommit()).append("\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
873 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
874 stmt = con.createStatement(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
875 sb.append("1. creating test table..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
876 stmt.executeUpdate("CREATE TABLE table_Test_PSgetObject (ti tinyint, si smallint, i int, bi bigint)"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
877 sb.append("success").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
878 stmt.close(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
879 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
880 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
881 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
882 closeStmtResSet(stmt, null); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
883 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
884 PreparedStatement pstmt = null; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
885 ResultSet rs = null; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
886 try { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
887 sb.append("2a. inserting 3 records as batch..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
888 pstmt = con.prepareStatement("INSERT INTO table_Test_PSgetObject (ti,si,i,bi) VALUES (?,?,?,?)"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
889 pstmt.setShort(1, (short)1); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
890 pstmt.setShort(2, (short)1); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
891 pstmt.setInt (3, 1); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
892 pstmt.setLong(4, (long)1); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
893 pstmt.addBatch(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
894 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
895 pstmt.setShort(1, (short)127); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
896 pstmt.setShort(2, (short)12700); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
897 pstmt.setInt (3, 1270000); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
898 pstmt.setLong(4, (long)127000000); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
899 pstmt.addBatch(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
900 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
901 pstmt.setShort(1, (short)-127); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
902 pstmt.setShort(2, (short)-12700); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
903 pstmt.setInt (3, -1270000); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
904 pstmt.setLong(4, (long)-127000000); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
905 pstmt.addBatch(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
906 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
907 pstmt.executeBatch(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
908 sb.append(" passed").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
909 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
910 sb.append("2b. closing PreparedStatement..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
911 pstmt.close(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
912 sb.append(" passed").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
913 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
914 sb.append("FAILED to INSERT data: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
915 while ((e = e.getNextException()) != null) |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
916 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
917 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
918 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
919 try { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
920 sb.append("3a. selecting records..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
921 pstmt = con.prepareStatement("SELECT ti,si,i,bi FROM table_Test_PSgetObject ORDER BY ti,si,i,bi"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
922 rs = pstmt.executeQuery(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
923 sb.append(" passed").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
924 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
925 while (rs.next()) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
926 // test fix for https://www.monetdb.org/bugzilla/show_bug.cgi?id=4026 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
927 Short ti = (Short) rs.getObject(1); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
928 Short si = (Short) rs.getObject(2); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
929 Integer i = (Integer) rs.getObject(3); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
930 Long bi = (Long) rs.getObject(4); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
931 |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
932 sb.append(" Retrieved row data: ti=").append(ti).append(" si=").append(si).append(" i=").append(i).append(" bi=").append(bi).append("\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
933 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
934 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
935 sb.append("3b. closing ResultSet..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
936 rs.close(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
937 sb.append(" passed").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
938 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
939 sb.append("3c. closing PreparedStatement..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
940 pstmt.close(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
941 sb.append(" passed").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
942 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
943 sb.append("FAILED to RETRIEVE data: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
944 while ((e = e.getNextException()) != null) |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
945 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
946 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
947 closeStmtResSet(pstmt, rs); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
948 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
949 try { |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
950 sb.append("4. Rollback changes..."); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
951 con.rollback(); |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
952 sb.append(" passed").append("\n"); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
953 |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
954 // restore default setting |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
955 con.setAutoCommit(true); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
956 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
957 sb.append("FAILED to rollback: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
958 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
959 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
960 compareExpectedOutput("Test_PSgetObject", |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
961 "0. false false\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
962 "1. creating test table...success\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
963 "2a. inserting 3 records as batch... passed\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
964 "2b. closing PreparedStatement... passed\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
965 "3a. selecting records... passed\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
966 " Retrieved row data: ti=-127 si=-12700 i=-1270000 bi=-127000000\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
967 " Retrieved row data: ti=1 si=1 i=1 bi=1\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
968 " Retrieved row data: ti=127 si=12700 i=1270000 bi=127000000\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
969 "3b. closing ResultSet... passed\n" + |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
970 "3c. closing PreparedStatement... passed\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
971 "4. Rollback changes... passed\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
972 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
973 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
974 private void Test_PSlargebatchval() { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
975 sb.setLength(0); // clear the output log buffer |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
976 |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
977 byte[] errorBytes = new byte[] { (byte) 0xe2, (byte) 0x80, (byte) 0xa7 }; |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
978 String errorStr = new String(errorBytes, Charset.forName("UTF-8")); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
979 StringBuilder repeatedErrorStr = new StringBuilder(); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
980 for (int i = 0; i < 8170;i++) { |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
981 repeatedErrorStr.append(errorStr); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
982 } |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
983 String largeStr = repeatedErrorStr.toString(); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
984 |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
985 Statement stmt = null; |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
986 PreparedStatement pstmt = null; |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
987 ResultSet rs = null; |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
988 try { |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
989 // >> true: auto commit should be on |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
990 sb.append("0. true\t").append(con.getAutoCommit()).append("\n"); |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
991 |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
992 stmt = con.createStatement(); |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
993 sb.append("1. creating test table..."); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
994 stmt.execute("CREATE TABLE Test_PSlargebatchval (c INT, a CLOB, b DOUBLE)"); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
995 sb.append("success").append("\n"); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
996 |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
997 sb.append("2. prepare insert..."); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
998 pstmt = con.prepareStatement("INSERT INTO Test_PSlargebatchval VALUES (?,?,?)"); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
999 sb.append("success").append("\n"); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1000 |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1001 pstmt.setLong(1, 1L); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1002 pstmt.setString(2, largeStr); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1003 pstmt.setDouble(3, 1.0); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1004 pstmt.addBatch(); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1005 pstmt.executeBatch(); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1006 sb.append("3. inserted 1 large string").append("\n"); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1007 |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1008 /* test issue reported at https://www.monetdb.org/bugzilla/show_bug.cgi?id=3470 */ |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1009 pstmt.setLong(1, -2L); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1010 pstmt.setClob(2, new StringReader(largeStr)); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1011 pstmt.setDouble(3, -2.0); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1012 pstmt.addBatch(); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1013 pstmt.executeBatch(); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1014 sb.append("4. inserted 1 large clob via StringReader() object").append("\n"); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1015 |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1016 Clob myClob = con.createClob(); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1017 myClob.setString(1L, largeStr); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1018 |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1019 pstmt.setLong(1, 123456789L); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1020 pstmt.setClob(2, myClob); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1021 pstmt.setDouble(3, 12345678901.98765); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1022 pstmt.addBatch(); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1023 pstmt.executeBatch(); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1024 sb.append("5. inserted 1 large clob via createClob() object").append("\n"); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1025 |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1026 pstmt.close(); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1027 |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1028 sb.append("6. select count(*)... "); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1029 rs = stmt.executeQuery("SELECT COUNT(*) FROM Test_PSlargebatchval"); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1030 if (rs.next()) |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1031 sb.append(rs.getInt(1)).append(" rows inserted.").append("\n"); |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1032 rs.close(); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1033 |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1034 sb.append("7. drop table..."); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1035 stmt.execute("DROP TABLE Test_PSlargebatchval"); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1036 sb.append("success").append("\n"); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1037 stmt.close(); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1038 } catch (SQLException e) { |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1039 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1040 while ((e = e.getNextException()) != null) |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1041 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1042 } |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1043 closeStmtResSet(stmt, rs); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1044 closeStmtResSet(pstmt, null); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1045 |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1046 compareExpectedOutput("Test_PSlargebatchval", |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1047 "0. true true\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1048 "1. creating test table...success\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1049 "2. prepare insert...success\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1050 "3. inserted 1 large string\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1051 "4. inserted 1 large clob via StringReader() object\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1052 "5. inserted 1 large clob via createClob() object\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1053 "6. select count(*)... 3 rows inserted.\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1054 "7. drop table...success\n"); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1055 } |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1056 |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1057 private void Test_PSlargeresponse(String conURL) { |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1058 sb.setLength(0); // clear the output log buffer |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1059 |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1060 PreparedStatement pstmt = null; |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1061 try { |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1062 sb.append("1. DatabaseMetadata environment retrieval... "); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1063 |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1064 // retrieve this to simulate a bug report |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1065 DatabaseMetaData dbmd = con.getMetaData(); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1066 if (conURL.startsWith(dbmd.getURL())) |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1067 sb.append("oke"); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1068 else |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1069 sb.append("not oke ").append(dbmd.getURL()); |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1070 sb.append("\n"); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1071 |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1072 pstmt = con.prepareStatement("select * from columns"); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1073 sb.append("2. empty call..."); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1074 // should succeed (no arguments given) |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1075 pstmt.execute(); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1076 sb.append(" passed").append("\n"); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1077 } catch (SQLException e) { |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1078 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1079 } |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1080 closeStmtResSet(pstmt, null); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1081 |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1082 compareExpectedOutput("Test_PSlargeresponse", |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1083 "1. DatabaseMetadata environment retrieval... oke\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1084 "2. empty call... passed\n"); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1085 } |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1086 |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1087 private void Test_PSmanycon(String arg0) { |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1088 sb.setLength(0); // clear the output log buffer |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1089 |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1090 final int maxCons = 60; // default max_clients is 64, 2 connections are already open from this program |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1091 List<PreparedStatement> pss = new ArrayList<PreparedStatement>(maxCons); // PreparedStatements go in here |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1092 |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1093 try { |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1094 // spawn a lot of Connections with 1 PreparedStatement, just for fun... |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1095 int i = 1; |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1096 sb.append("Establishing Connection "); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1097 for (; i <= maxCons; i++) { |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1098 sb.append(i); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1099 Connection conx = DriverManager.getConnection(arg0); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1100 sb.append(","); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1101 |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1102 // do something with the connection to test if it works |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1103 PreparedStatement pstmt = conx.prepareStatement("select " + i); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1104 sb.append(" "); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1105 |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1106 pss.add(pstmt); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1107 } |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1108 sb.append("\n"); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1109 |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1110 // now try to nicely execute them |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1111 i = 1; |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1112 sb.append("Executing PreparedStatement\n"); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1113 for (Iterator<PreparedStatement> it = pss.iterator(); it.hasNext(); i++) { |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1114 PreparedStatement pstmt = it.next(); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1115 |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1116 // see if the connection still works |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1117 sb.append(i).append("..."); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1118 if (!pstmt.execute()) |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1119 sb.append("should have seen a ResultSet!"); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1120 |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1121 ResultSet rs = pstmt.getResultSet(); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1122 if (!rs.next()) |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1123 sb.append("ResultSet is empty"); |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1124 sb.append(" result: ").append(rs.getString(1)); |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1125 |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1126 // close the connection and associated resources |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1127 pstmt.getConnection().close(); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1128 sb.append(", closed. "); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1129 |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1130 if (i % 5 == 0) { |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1131 // inject a failed transaction |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1132 Connection conZZ = DriverManager.getConnection(arg0); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1133 Statement stmt = con.createStatement(); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1134 try { |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1135 int affrows = stmt.executeUpdate("update foo where bar is wrong"); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1136 sb.append("oops, faulty statement just got through"); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1137 } catch (SQLException e) { |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1138 sb.append("Forced transaction failure"); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1139 } |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1140 sb.append("\n"); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1141 closeStmtResSet(stmt, null); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1142 conZZ.close(); |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1143 } |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1144 } |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1145 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1146 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1147 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1148 |
399
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1149 compareExpectedOutput("Test_PSmanycon", |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1150 "Establishing Connection 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, " + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1151 "11, 12, 13, 14, 15, 16, 17, 18, 19, 20, " + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1152 "21, 22, 23, 24, 25, 26, 27, 28, 29, 30, " + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1153 "31, 32, 33, 34, 35, 36, 37, 38, 39, 40, " + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1154 "41, 42, 43, 44, 45, 46, 47, 48, 49, 50, " + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1155 "51, 52, 53, 54, 55, 56, 57, 58, 59, 60, \n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1156 "Executing PreparedStatement\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1157 "1... result: 1, closed. 2... result: 2, closed. 3... result: 3, closed. 4... result: 4, closed. 5... result: 5, closed. Forced transaction failure\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1158 "6... result: 6, closed. 7... result: 7, closed. 8... result: 8, closed. 9... result: 9, closed. 10... result: 10, closed. Forced transaction failure\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1159 "11... result: 11, closed. 12... result: 12, closed. 13... result: 13, closed. 14... result: 14, closed. 15... result: 15, closed. Forced transaction failure\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1160 "16... result: 16, closed. 17... result: 17, closed. 18... result: 18, closed. 19... result: 19, closed. 20... result: 20, closed. Forced transaction failure\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1161 "21... result: 21, closed. 22... result: 22, closed. 23... result: 23, closed. 24... result: 24, closed. 25... result: 25, closed. Forced transaction failure\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1162 "26... result: 26, closed. 27... result: 27, closed. 28... result: 28, closed. 29... result: 29, closed. 30... result: 30, closed. Forced transaction failure\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1163 "31... result: 31, closed. 32... result: 32, closed. 33... result: 33, closed. 34... result: 34, closed. 35... result: 35, closed. Forced transaction failure\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1164 "36... result: 36, closed. 37... result: 37, closed. 38... result: 38, closed. 39... result: 39, closed. 40... result: 40, closed. Forced transaction failure\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1165 "41... result: 41, closed. 42... result: 42, closed. 43... result: 43, closed. 44... result: 44, closed. 45... result: 45, closed. Forced transaction failure\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1166 "46... result: 46, closed. 47... result: 47, closed. 48... result: 48, closed. 49... result: 49, closed. 50... result: 50, closed. Forced transaction failure\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1167 "51... result: 51, closed. 52... result: 52, closed. 53... result: 53, closed. 54... result: 54, closed. 55... result: 55, closed. Forced transaction failure\n" + |
addb345e4fa8
Changed test 'getIndexInfo(null, sys, table_types, false, false)' to resolve difference (9 instead of 10) reported on testweb for default branch.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
395
diff
changeset
|
1168 "56... result: 56, closed. 57... result: 57, closed. 58... result: 58, closed. 59... result: 59, closed. 60... result: 60, closed. Forced transaction failure\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1169 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1170 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1171 private void Test_PSmetadata() { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1172 sb.setLength(0); // clear the output log buffer |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1173 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1174 Statement stmt = null; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1175 try { |
400
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1176 con.setAutoCommit(false); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1177 // >> false: auto commit was just switched off |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1178 sb.append("0. false\t").append(con.getAutoCommit()).append("\n"); |
400
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1179 |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1180 stmt = con.createStatement(); |
400
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1181 int updates = 0; |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1182 updates = stmt.executeUpdate("CREATE TABLE table_Test_PSmetadata ( myint int, mydouble double, mybool boolean, myvarchar varchar(15), myclob clob )"); |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1183 if (updates != Statement.SUCCESS_NO_INFO) |
400
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1184 sb.append("1. Expected -2 got ").append(updates).append(" instead\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1185 |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1186 // all NULLs |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1187 updates = stmt.executeUpdate("INSERT INTO table_Test_PSmetadata VALUES (NULL, NULL, NULL, NULL, NULL)"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1188 if (updates != 1) |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1189 sb.append("2a. Expected 1 got ").append(updates).append(" instead\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1190 |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1191 // all filled in |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1192 updates = stmt.executeUpdate("INSERT INTO table_Test_PSmetadata VALUES (2 , 3.0, true, 'A string', 'bla bla bla')"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1193 if (updates != 1) |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1194 sb.append("2b. Expected 1 got ").append(updates).append(" instead\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1195 } catch (SQLException e) { |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1196 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1197 } |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1198 closeStmtResSet(stmt, null); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1199 |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1200 PreparedStatement pstmt = null; |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1201 try { |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1202 pstmt = con.prepareStatement("SELECT CASE WHEN myint IS NULL THEN 0 ELSE 1 END AS intnull, * FROM table_Test_PSmetadata WHERE myint = ?"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1203 |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1204 // testing and showing result set meta data |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1205 ResultSetMetaData rsmd = pstmt.getMetaData(); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1206 sb.append("rsmd. ").append(rsmd.getColumnCount()).append(" columns:\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1207 for (int col = 1; col <= rsmd.getColumnCount(); col++) { |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1208 sb.append("RCol ").append(col).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1209 sb.append(" classname ").append(rsmd.getColumnClassName(col)).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1210 sb.append(" displaysize ").append(rsmd.getColumnDisplaySize(col)).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1211 sb.append(" label ").append(rsmd.getColumnLabel(col)).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1212 sb.append(" name ").append(rsmd.getColumnName(col)).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1213 sb.append(" type ").append(rsmd.getColumnType(col)).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1214 sb.append(" typename ").append(rsmd.getColumnTypeName(col)).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1215 sb.append(" precision ").append(rsmd.getPrecision(col)).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1216 sb.append(" scale ").append(rsmd.getScale(col)).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1217 sb.append(" catalogname ").append(rsmd.getCatalogName(col)).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1218 sb.append(" schemaname ").append(rsmd.getSchemaName(col)).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1219 sb.append(" tablename ").append(rsmd.getTableName(col)).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1220 sb.append(" autoincrement ").append(rsmd.isAutoIncrement(col)).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1221 sb.append(" casesensitive ").append(rsmd.isCaseSensitive(col)).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1222 sb.append(" currency ").append(rsmd.isCurrency(col)).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1223 sb.append(" defwritable ").append(rsmd.isDefinitelyWritable(col)).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1224 sb.append(" nullable ").append(rsmd.isNullable(col)).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1225 sb.append(" readonly ").append(rsmd.isReadOnly(col)).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1226 sb.append(" searchable ").append(rsmd.isSearchable(col)).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1227 sb.append(" signed ").append(rsmd.isSigned(col)).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1228 sb.append(" writable ").append(rsmd.isWritable(col)).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1229 } |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1230 |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1231 showParams(pstmt); |
400
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1232 |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1233 con.rollback(); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1234 con.setAutoCommit(true); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1235 // >> true: auto commit was just switched on |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1236 sb.append("0. true\t").append(con.getAutoCommit()).append("\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1237 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1238 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1239 } |
400
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1240 closeStmtResSet(pstmt, null); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1241 |
400
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1242 compareExpectedOutput("Test_PSmetadata", |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1243 "0. false\tfalse\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1244 "rsmd. 6 columns:\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1245 "RCol 1\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1246 " classname java.lang.Short\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1247 " displaysize 8\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1248 " label intnull\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1249 " name intnull\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1250 " type -6\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1251 " typename tinyint\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1252 " precision 8\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1253 " scale 0\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1254 " catalogname null\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1255 " schemaname \n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1256 " tablename \n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1257 " autoincrement false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1258 " casesensitive false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1259 " currency false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1260 " defwritable false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1261 " nullable 2\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1262 " readonly true\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1263 " searchable true\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1264 " signed true\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1265 " writable false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1266 "RCol 2\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1267 " classname java.lang.Integer\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1268 " displaysize 32\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1269 " label myint\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1270 " name myint\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1271 " type 4\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1272 " typename int\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1273 " precision 32\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1274 " scale 0\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1275 " catalogname null\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1276 " schemaname \n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1277 " tablename table_test_psmetadata\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1278 " autoincrement false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1279 " casesensitive false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1280 " currency false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1281 " defwritable false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1282 " nullable 2\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1283 " readonly true\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1284 " searchable true\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1285 " signed true\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1286 " writable false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1287 "RCol 3\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1288 " classname java.lang.Double\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1289 " displaysize 53\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1290 " label mydouble\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1291 " name mydouble\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1292 " type 8\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1293 " typename double\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1294 " precision 53\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1295 " scale 0\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1296 " catalogname null\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1297 " schemaname \n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1298 " tablename table_test_psmetadata\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1299 " autoincrement false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1300 " casesensitive false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1301 " currency false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1302 " defwritable false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1303 " nullable 2\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1304 " readonly true\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1305 " searchable true\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1306 " signed true\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1307 " writable false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1308 "RCol 4\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1309 " classname java.lang.Boolean\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1310 " displaysize 1\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1311 " label mybool\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1312 " name mybool\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1313 " type 16\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1314 " typename boolean\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1315 " precision 1\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1316 " scale 0\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1317 " catalogname null\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1318 " schemaname \n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1319 " tablename table_test_psmetadata\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1320 " autoincrement false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1321 " casesensitive false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1322 " currency false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1323 " defwritable false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1324 " nullable 2\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1325 " readonly true\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1326 " searchable true\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1327 " signed false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1328 " writable false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1329 "RCol 5\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1330 " classname java.lang.String\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1331 " displaysize 15\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1332 " label myvarchar\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1333 " name myvarchar\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1334 " type 12\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1335 " typename varchar\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1336 " precision 15\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1337 " scale 0\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1338 " catalogname null\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1339 " schemaname \n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1340 " tablename table_test_psmetadata\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1341 " autoincrement false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1342 " casesensitive true\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1343 " currency false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1344 " defwritable false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1345 " nullable 2\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1346 " readonly true\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1347 " searchable true\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1348 " signed false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1349 " writable false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1350 "RCol 6\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1351 " classname java.lang.String\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1352 " displaysize 0\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1353 " label myclob\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1354 " name myclob\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1355 " type 12\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1356 " typename clob\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1357 " precision 0\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1358 " scale 0\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1359 " catalogname null\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1360 " schemaname \n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1361 " tablename table_test_psmetadata\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1362 " autoincrement false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1363 " casesensitive true\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1364 " currency false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1365 " defwritable false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1366 " nullable 2\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1367 " readonly true\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1368 " searchable true\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1369 " signed false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1370 " writable false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1371 "pmd. 1 parameters:\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1372 "Param 1\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1373 " nullable 2 (UNKNOWN)\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1374 " signed true\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1375 " precision 32\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1376 " scale 0\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1377 " type 4\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1378 " typename int\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1379 " classname java.lang.Integer\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1380 " mode 1 (IN)\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1381 "0. true\ttrue\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1382 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1383 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1384 private void Test_PSsomeamount() { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1385 sb.setLength(0); // clear the output log buffer |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1386 |
400
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1387 PreparedStatement pstmt = null; |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1388 ResultSet rs = null; |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1389 try { |
400
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1390 // >> true: auto commit should be on |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1391 sb.append("0. true\t").append(con.getAutoCommit()).append("\n"); |
400
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1392 |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1393 sb.append("1. Preparing and executing a unique statement").append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1394 for (int i = 0; i < 120; i++) { |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1395 pstmt = con.prepareStatement("select " + i + ", " + i + " = ?"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1396 pstmt.setInt(1, i); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1397 rs = pstmt.executeQuery(); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1398 if (rs.next() && i % 20 == 0) { |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1399 sb.append(rs.getInt(1)).append(", ").append(rs.getBoolean(2)).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1400 } |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1401 /* next call should cause resources on the server to be freed */ |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1402 pstmt.close(); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1403 } |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1404 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1405 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1406 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1407 |
400
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1408 closeStmtResSet(pstmt, rs); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1409 |
400
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1410 compareExpectedOutput("Test_PSsomeamount", |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1411 "0. true true\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1412 "1. Preparing and executing a unique statement\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1413 "0, true\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1414 "20, true\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1415 "40, true\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1416 "60, true\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1417 "80, true\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1418 "100, true\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1419 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1420 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1421 private void Test_PSsqldata() { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1422 sb.setLength(0); // clear the output log buffer |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1423 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1424 Statement stmt = null; |
400
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1425 PreparedStatement pstmt = null; |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1426 ResultSet rs = null; |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1427 try { |
400
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1428 con.setAutoCommit(false); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1429 // >> false: auto commit should be off now |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1430 sb.append("0. false\t").append(con.getAutoCommit()).append("\n"); |
400
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1431 |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1432 stmt = con.createStatement(); |
400
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1433 int updates = stmt.executeUpdate("CREATE TABLE table_Test_PSsqldata ( myinet inet, myurl url )"); |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1434 if (updates != Statement.SUCCESS_NO_INFO) |
400
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1435 sb.append("1. Expected -2 got ").append(updates).append(" instead\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1436 |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1437 pstmt = con.prepareStatement("INSERT INTO table_Test_PSsqldata VALUES (?, ?)"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1438 ParameterMetaData pmd = pstmt.getParameterMetaData(); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1439 sb.append(pmd.getParameterCount()).append(" parameters:\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1440 for (int parm = 1; parm <= pmd.getParameterCount(); parm++) { |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1441 sb.append("Parm ").append(parm).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1442 sb.append(" type ").append(pmd.getParameterType(parm)).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1443 sb.append(" typename ").append(pmd.getParameterTypeName(parm)).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1444 sb.append(" classname ").append(pmd.getParameterClassName(parm)).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1445 } |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1446 |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1447 INET tinet = new INET(); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1448 tinet.fromString("172.5.5.5/24"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1449 |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1450 URL turl = new URL(); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1451 try { |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1452 turl.fromString("http://www.monetdb.org/"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1453 } catch (Exception e) { |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1454 sb.append("conversion failed: ").append(e.getMessage()).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1455 } |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1456 pstmt.setObject(1, tinet); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1457 pstmt.setObject(2, turl); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1458 // insert first record |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1459 pstmt.execute(); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1460 |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1461 try { |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1462 tinet.setNetmaskBits(16); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1463 } catch (Exception e) { |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1464 sb.append("setNetmaskBits failed: ").append(e.getMessage()).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1465 } |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1466 // insert second record |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1467 pstmt.execute(); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1468 |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1469 rs = stmt.executeQuery("SELECT * FROM table_Test_PSsqldata"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1470 ResultSetMetaData rsmd = rs.getMetaData(); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1471 for (int i = 1; rs.next(); i++) { |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1472 for (int col = 1; col <= rsmd.getColumnCount(); col++) { |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1473 Object x = rs.getObject(col); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1474 if (x == null || rs.wasNull()) { |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1475 sb.append(i).append(".\t<null>").append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1476 } else { |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1477 sb.append(i).append(".\t").append(x.toString()).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1478 if (x instanceof INET) { |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1479 INET inet = (INET)x; |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1480 sb.append(" ").append(inet.getAddress()).append("/").append(inet.getNetmaskBits()).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1481 sb.append(" ").append(inet.getInetAddress().toString()).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1482 } else if (x instanceof URL) { |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1483 URL url = (URL)x; |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1484 sb.append(" ").append(url.getURL().toString()).append("\n"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1485 } |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1486 } |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1487 } |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1488 } |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1489 con.rollback(); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1490 con.setAutoCommit(true); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1491 // >> true: auto commit was just switched on |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1492 sb.append("0. true\t").append(con.getAutoCommit()).append("\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1493 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1494 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1495 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1496 |
400
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1497 closeStmtResSet(stmt, rs); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1498 closeStmtResSet(pstmt, null); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1499 |
400
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1500 compareExpectedOutput("Test_PSsqldata", |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1501 "0. false false\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1502 "2 parameters:\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1503 "Parm 1\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1504 " type 12\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1505 " typename inet\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1506 " classname org.monetdb.jdbc.types.INET\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1507 "Parm 2\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1508 " type 12\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1509 " typename url\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1510 " classname org.monetdb.jdbc.types.URL\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1511 "1. 172.5.5.5/24\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1512 " 172.5.5.5/24\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1513 " /172.5.5.5\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1514 "1. http://www.monetdb.org/\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1515 " http://www.monetdb.org/\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1516 "2. 172.5.5.5/24\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1517 " 172.5.5.5/24\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1518 " /172.5.5.5\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1519 "2. http://www.monetdb.org/\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1520 " http://www.monetdb.org/\n" + |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
1521 "0. true true\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1522 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1523 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1524 private void Test_PStimedate() { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1525 sb.setLength(0); // clear the output log buffer |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1526 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1527 Statement stmt = null; |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1528 PreparedStatement pstmt = null; |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1529 ResultSet rs = null; |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1530 try { |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1531 con.setAutoCommit(false); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1532 // >> false: auto commit should be off now |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1533 sb.append("0. false\t").append(con.getAutoCommit()).append("\n"); |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1534 |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1535 stmt = con.createStatement(); |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1536 int updates = stmt.executeUpdate("CREATE TABLE Test_PStimedate (t time, ts timestamp, d date)"); |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1537 if (updates != Statement.SUCCESS_NO_INFO) |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1538 sb.append("1. Expected -2 got ").append(updates).append(" instead\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1539 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1540 pstmt = con.prepareStatement("INSERT INTO Test_PStimedate VALUES (?, ?, ?)"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1541 sb.append("1. empty call..."); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1542 try { |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1543 // should fail (as no parameters set) |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1544 pstmt.execute(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1545 sb.append(" UNexpected PASS!\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1546 } catch (SQLException e) { |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1547 sb.append(" expected exception\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1548 } |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1549 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1550 sb.append("2. inserting a record..."); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1551 java.util.Date d = new java.util.Date(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1552 pstmt.setTime(1, new java.sql.Time(d.getTime())); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1553 pstmt.setTimestamp(2, new java.sql.Timestamp(d.getTime())); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1554 pstmt.setDate(3, new java.sql.Date(d.getTime())); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1555 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1556 pstmt.executeUpdate(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1557 sb.append(" passed\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1558 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1559 sb.append("3. closing PreparedStatement..."); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1560 pstmt.close(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1561 sb.append(" passed\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1562 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1563 sb.append("4. selecting record..."); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1564 pstmt = con.prepareStatement("SELECT * FROM Test_PStimedate"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1565 rs = pstmt.executeQuery(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1566 sb.append(" passed\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1567 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1568 while (rs.next()) { |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1569 for (int j = 1; j <= 3; j++) { |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1570 sb.append((j+4)).append(". retrieving..."); |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1571 java.util.Date x = (java.util.Date)(rs.getObject(j)); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1572 boolean matches = false; |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1573 if (x instanceof Time) { |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1574 sb.append(" (Time)"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1575 matches = (new Time(d.getTime())).toString().equals(x.toString()); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1576 } else if (x instanceof Date) { |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1577 sb.append(" (Date)"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1578 matches = (new Date(d.getTime())).toString().equals(x.toString()); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1579 } else if (x instanceof Timestamp) { |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1580 sb.append(" (Timestamp)"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1581 matches = (new Timestamp(d.getTime())).toString().equals(x.toString()); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1582 } |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1583 if (matches) { |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1584 sb.append(" passed\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1585 } else { |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1586 sb.append(" FAILED (").append(x).append(" is not ").append(d).append(")\n"); |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1587 } |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1588 } |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1589 } |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1590 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1591 con.rollback(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1592 con.setAutoCommit(true); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1593 // >> true: auto commit was just switched on |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1594 sb.append("0. true\t").append(con.getAutoCommit()).append("\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1595 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1596 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1597 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1598 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1599 closeStmtResSet(stmt, null); |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1600 closeStmtResSet(pstmt, rs); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1601 |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1602 compareExpectedOutput("Test_PStimedate", |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1603 "0. false false\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1604 "1. empty call... expected exception\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1605 "2. inserting a record... passed\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1606 "3. closing PreparedStatement... passed\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1607 "4. selecting record... passed\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1608 "5. retrieving... (Time) passed\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1609 "6. retrieving... (Timestamp) passed\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1610 "7. retrieving... (Date) passed\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1611 "0. true true\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1612 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1613 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1614 private void Test_PStimezone() { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1615 sb.setLength(0); // clear the output log buffer |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1616 |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1617 // make sure this test is reproducable regardless timezone |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1618 // setting, by overriding the VM's default |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1619 // we have to make sure that one doesn't have daylight |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1620 // savings corrections |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1621 TimeZone.setDefault(TimeZone.getTimeZone("UTC")); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1622 |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1623 Statement stmt = null; |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1624 PreparedStatement pstmt = null; |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1625 ResultSet rs = null; |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1626 try { |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1627 con.setAutoCommit(false); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1628 // >> false: auto commit should be off now |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1629 sb.append("0. false\t").append(con.getAutoCommit()).append("\n"); |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1630 |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1631 stmt = con.createStatement(); |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1632 int updates = stmt.executeUpdate("CREATE TABLE Test_PStimezone (ts timestamp, tsz timestamp with time zone, t time, tz time with time zone)"); |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1633 if (updates != Statement.SUCCESS_NO_INFO) |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1634 sb.append("1. Expected -2 got ").append(updates).append(" instead\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1635 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1636 pstmt = con.prepareStatement("INSERT INTO Test_PStimezone VALUES (?, ?, ?, ?)"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1637 sb.append("1. empty call..."); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1638 try { |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1639 // should fail (as no parameters set) |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1640 pstmt.execute(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1641 sb.append(" UNexpected PASS!\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1642 } catch (SQLException e) { |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1643 sb.append(" expected exception\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1644 } |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1645 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1646 sb.append("2. inserting records...\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1647 java.sql.Timestamp ts = new java.sql.Timestamp(0L); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1648 java.sql.Time t = new java.sql.Time(0L); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1649 Calendar c = Calendar.getInstance(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1650 SimpleDateFormat tsz = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSZ"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1651 SimpleDateFormat tz = new SimpleDateFormat("HH:mm:ss.SSSZ"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1652 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1653 tsz.setTimeZone(c.getTimeZone()); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1654 tz.setTimeZone(tsz.getTimeZone()); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1655 sb.append("inserting (").append(c.getTimeZone().getID()).append(") ").append(tsz.format(ts)).append(", ").append(tz.format(t)).append("\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1656 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1657 pstmt.setTimestamp(1, ts); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1658 pstmt.setTimestamp(2, ts); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1659 pstmt.setTime(3, t); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1660 pstmt.setTime(4, t); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1661 pstmt.executeUpdate(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1662 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1663 c.setTimeZone(TimeZone.getTimeZone("UTC")); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1664 sb.append("inserting with calendar timezone ").append(c.getTimeZone().getID()).append("\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1665 pstmt.setTimestamp(1, ts, c); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1666 pstmt.setTimestamp(2, ts, c); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1667 pstmt.setTime(3, t, c); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1668 pstmt.setTime(4, t, c); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1669 pstmt.executeUpdate(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1670 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1671 c.setTimeZone(TimeZone.getTimeZone("America/Los_Angeles")); |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1672 sb.append("inserting with calendar timezone ").append(c.getTimeZone().getID()).append("\n"); |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1673 pstmt.setTimestamp(1, ts, c); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1674 pstmt.setTimestamp(2, ts); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1675 pstmt.setTime(3, t, c); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1676 pstmt.setTime(4, t); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1677 pstmt.executeUpdate(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1678 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1679 c.setTimeZone(TimeZone.getTimeZone("GMT+04:15")); |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1680 sb.append("inserting with calendar timezone ").append(c.getTimeZone().getID()).append("\n"); |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1681 pstmt.setTimestamp(1, ts); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1682 pstmt.setTimestamp(2, ts, c); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1683 pstmt.setTime(3, t); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1684 pstmt.setTime(4, t, c); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1685 pstmt.executeUpdate(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1686 sb.append(" done\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1687 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1688 sb.append("3. closing PreparedStatement..."); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1689 pstmt.close(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1690 sb.append(" passed\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1691 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1692 sb.append("4. selecting records..."); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1693 pstmt = con.prepareStatement("SELECT * FROM Test_PStimezone"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1694 rs = pstmt.executeQuery(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1695 sb.append(" passed\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1696 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1697 // The tz fields should basically always be the same |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1698 // (exactly 1st Jan 1970) since whatever timezone is used, |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1699 // the server retains it, and Java restores it. |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1700 // The zoneless fields will show differences since the time |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1701 // is inserted translated to the given timezones, and |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1702 // retrieved as in they were given in those timezones. |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1703 // When the insert zone matches the retrieve zone, Java should |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1704 // eventually see 1st Jan 1970. |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1705 while (rs.next()) { |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1706 sb.append("retrieved row (String):\n").append( |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1707 rs.getString("ts")).append(" | ").append( |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1708 rs.getString("tsz")).append(" | ").append( |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1709 rs.getString("t")).append(" | ").append( |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1710 rs.getString("tz")).append("\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1711 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1712 tsz.setTimeZone(TimeZone.getDefault()); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1713 tz.setTimeZone(tsz.getTimeZone()); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1714 sb.append("default (").append(tsz.getTimeZone().getID()).append("):\n").append( |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1715 tsz.format(rs.getTimestamp("ts"))).append(" | ").append( |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1716 tsz.format(rs.getTimestamp("tsz"))).append(" | ").append( |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1717 tz.format(rs.getTime("t"))).append(" | ").append( |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1718 tz.format(rs.getTime("tz"))).append("\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1719 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1720 c.setTimeZone(TimeZone.getTimeZone("America/Los_Angeles")); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1721 sb.append(c.getTimeZone().getID()).append(":\n").append( |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1722 rs.getTimestamp("ts", c)).append(" | ").append( |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1723 rs.getTimestamp("tsz", c)).append(" | ").append( |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1724 rs.getTime("t", c)).append(" | ").append( |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1725 rs.getTime("tz", c)).append("\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1726 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1727 c.setTimeZone(TimeZone.getTimeZone("Africa/Windhoek")); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1728 sb.append(c.getTimeZone().getID()).append(":\n").append( |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1729 rs.getTimestamp("ts", c)).append(" | ").append( |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1730 rs.getTimestamp("tsz", c)).append(" | ").append( |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1731 rs.getTime("t", c)).append(" | ").append( |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1732 rs.getTime("tz", c)).append("\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1733 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1734 SQLWarning w = rs.getWarnings(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1735 while (w != null) { |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1736 sb.append(w.getMessage()).append("\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1737 w = w.getNextWarning(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1738 } |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1739 } |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1740 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1741 con.rollback(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1742 con.setAutoCommit(true); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1743 // >> true: auto commit was just switched on |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1744 sb.append("0. true\t").append(con.getAutoCommit()).append("\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1745 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1746 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1747 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1748 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1749 closeStmtResSet(stmt, null); |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1750 closeStmtResSet(pstmt, rs); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1751 |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1752 compareExpectedOutput("Test_PStimezone", |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1753 "0. false false\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1754 "1. empty call... expected exception\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1755 "2. inserting records...\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1756 "inserting (UTC) 1970-01-01 00:00:00.000+0000, 00:00:00.000+0000\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1757 "inserting with calendar timezone UTC\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1758 "inserting with calendar timezone America/Los_Angeles\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1759 "inserting with calendar timezone GMT+04:15\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1760 " done\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1761 "3. closing PreparedStatement... passed\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1762 "4. selecting records... passed\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1763 "retrieved row (String):\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1764 "1970-01-01 00:00:00.000000 | 1970-01-01 01:00:00.000000+01:00 | 00:00:00 | 01:00:00+01:00\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1765 "default (UTC):\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1766 "1970-01-01 00:00:00.000+0000 | 1970-01-01 00:00:00.000+0000 | 00:00:00.000+0000 | 00:00:00.000+0000\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1767 "America/Los_Angeles:\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1768 "1970-01-01 08:00:00.0 | 1970-01-01 00:00:00.0 | 08:00:00 | 00:00:00\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1769 "Africa/Windhoek:\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1770 "1969-12-31 22:00:00.0 | 1970-01-01 00:00:00.0 | 22:00:00 | 00:00:00\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1771 "retrieved row (String):\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1772 "1970-01-01 00:00:00.000000 | 1970-01-01 01:00:00.000000+01:00 | 00:00:00 | 01:00:00+01:00\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1773 "default (UTC):\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1774 "1970-01-01 00:00:00.000+0000 | 1970-01-01 00:00:00.000+0000 | 00:00:00.000+0000 | 00:00:00.000+0000\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1775 "America/Los_Angeles:\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1776 "1970-01-01 08:00:00.0 | 1970-01-01 00:00:00.0 | 08:00:00 | 00:00:00\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1777 "Africa/Windhoek:\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1778 "1969-12-31 22:00:00.0 | 1970-01-01 00:00:00.0 | 22:00:00 | 00:00:00\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1779 "retrieved row (String):\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1780 "1969-12-31 16:00:00.000000 | 1970-01-01 01:00:00.000000+01:00 | 16:00:00 | 01:00:00+01:00\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1781 "default (UTC):\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1782 "1969-12-31 16:00:00.000+0000 | 1970-01-01 00:00:00.000+0000 | 16:00:00.000+0000 | 00:00:00.000+0000\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1783 "America/Los_Angeles:\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1784 "1970-01-01 00:00:00.0 | 1970-01-01 00:00:00.0 | 00:00:00 | 00:00:00\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1785 "Africa/Windhoek:\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1786 "1969-12-31 14:00:00.0 | 1970-01-01 00:00:00.0 | 14:00:00 | 00:00:00\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1787 "retrieved row (String):\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1788 "1970-01-01 00:00:00.000000 | 1970-01-01 01:00:00.000000+01:00 | 00:00:00 | 01:00:00+01:00\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1789 "default (UTC):\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1790 "1970-01-01 00:00:00.000+0000 | 1970-01-01 00:00:00.000+0000 | 00:00:00.000+0000 | 00:00:00.000+0000\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1791 "America/Los_Angeles:\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1792 "1970-01-01 08:00:00.0 | 1970-01-01 00:00:00.0 | 08:00:00 | 00:00:00\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1793 "Africa/Windhoek:\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1794 "1969-12-31 22:00:00.0 | 1970-01-01 00:00:00.0 | 22:00:00 | 00:00:00\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1795 "0. true true\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1796 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1797 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1798 private void Test_PStypes() { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1799 sb.setLength(0); // clear the output log buffer |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1800 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1801 Statement stmt = null; |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1802 PreparedStatement pstmt = null; |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1803 try { |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1804 con.setAutoCommit(false); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1805 // >> false: auto commit should be off now |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1806 sb.append("0. false\t").append(con.getAutoCommit()).append("\n"); |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1807 |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1808 stmt = con.createStatement(); |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1809 int updates = stmt.executeUpdate( |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1810 "CREATE TABLE htmtest (" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1811 " htmid bigint NOT NULL," + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1812 " ra double ," + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1813 " decl double ," + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1814 " dra double ," + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1815 " ddecl double ," + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1816 " flux double ," + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1817 " dflux double ," + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1818 " freq double ," + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1819 " bw double ," + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1820 " type decimal(1,0)," + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1821 " imageurl varchar(100)," + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1822 " comment varchar(100)," + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1823 " CONSTRAINT htmtest_htmid_pkey PRIMARY KEY (htmid)" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1824 ")" ); |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1825 if (updates != Statement.SUCCESS_NO_INFO) |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1826 sb.append("1. Expected -2 got ").append(updates).append(" instead\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1827 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1828 // index is not used, but the original bug had it too |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1829 updates = stmt.executeUpdate("CREATE INDEX htmid ON htmtest (htmid)"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1830 if (updates != Statement.SUCCESS_NO_INFO) |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1831 sb.append("1. Expected -2 got ").append(updates).append(" instead\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1832 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1833 stmt.close(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1834 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1835 pstmt = con.prepareStatement("INSERT INTO HTMTEST (HTMID,RA,DECL,FLUX,COMMENT) VALUES (?,?,?,?,?)"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1836 sb.append("1. inserting a record..."); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1837 pstmt.setLong(1, 1L); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1838 pstmt.setFloat(2, (float)1.2); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1839 pstmt.setDouble(3, 2.4); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1840 pstmt.setDouble(4, 3.2); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1841 pstmt.setString(5, "vlavbla"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1842 pstmt.executeUpdate(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1843 sb.append("success\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1844 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1845 // try an update like bug #1757923 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1846 pstmt = con.prepareStatement("UPDATE HTMTEST set COMMENT=?, TYPE=? WHERE HTMID=?"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1847 sb.append("2. updating record..."); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1848 pstmt.setString(1, "some update"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1849 pstmt.setObject(2, (float)3.2); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1850 pstmt.setLong(3, 1L); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1851 pstmt.executeUpdate(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1852 sb.append("success\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1853 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1854 pstmt.close(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1855 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1856 con.rollback(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1857 con.setAutoCommit(true); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1858 // >> true: auto commit was just switched on |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1859 sb.append("0. true\t").append(con.getAutoCommit()).append("\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1860 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1861 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1862 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1863 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1864 closeStmtResSet(stmt, null); |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1865 closeStmtResSet(pstmt, null); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1866 |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1867 compareExpectedOutput("Test_PStypes", |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1868 "0. false false\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1869 "1. inserting a record...success\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1870 "2. updating record...success\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1871 "0. true true\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1872 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1873 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1874 private void Test_CallableStmt() { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1875 sb.setLength(0); // clear the output log buffer |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1876 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1877 Statement stmt = null; |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1878 CallableStatement cstmt = null; |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1879 try { |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1880 String tbl_nm = "tbl6402"; |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1881 String proc_nm = "proc6402"; |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1882 |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1883 stmt = con.createStatement(); |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1884 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1885 // create a test table. |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1886 stmt.executeUpdate("CREATE TABLE IF NOT EXISTS " + tbl_nm + " (tint int, tdouble double, tbool boolean, tvarchar varchar(15), tclob clob, turl url, tclen int);"); |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1887 sb.append("Created table: ").append(tbl_nm).append("\n"); |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1888 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1889 // create a procedure with multiple different IN parameters which inserts a row into a table of which one column is computed. |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1890 stmt.executeUpdate("CREATE PROCEDURE " + proc_nm + " (myint int, mydouble double, mybool boolean, myvarchar varchar(15), myclob clob, myurl url) BEGIN" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1891 " INSERT INTO " + tbl_nm + " (tint, tdouble, tbool, tvarchar, tclob, turl, tclen) VALUES (myint, mydouble, mybool, myvarchar, myclob, myurl, LENGTH(myvarchar) + LENGTH(myclob)); " + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1892 "END;"); |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1893 sb.append("Created procedure: ").append(proc_nm).append("\n"); |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1894 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1895 // make sure we can call the procedure the old way (as string) |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1896 stmt.executeUpdate("call " + proc_nm + "(1, 1.1, true,'one','ONE', 'www.monetdb.org');"); |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1897 sb.append("Called procedure (1): ").append(proc_nm).append("\n"); |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1898 showTblContents(tbl_nm); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1899 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1900 // now use a CallableStament object |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1901 cstmt = con.prepareCall(" { call " + proc_nm + " (?,?, ?, ? , ?,?) } ;"); |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1902 sb.append("Prepared Callable procedure: ").append(proc_nm).append("\n"); |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1903 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1904 // specify first set of params |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1905 cstmt.setInt(1, 2); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1906 cstmt.setDouble(2, 2.02); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1907 cstmt.setBoolean(3, true); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1908 cstmt.setString(4, "Two"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1909 Clob myclob = con.createClob(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1910 myclob.setString(1, "TWOs"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1911 cstmt.setClob(5, myclob); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1912 cstmt.setString(6, "http://www.monetdb.org/"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1913 cstmt.execute(); |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1914 sb.append("Called Prepared procedure (1): ").append(proc_nm).append("\n"); |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1915 showParams(cstmt); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1916 showTblContents(tbl_nm); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1917 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1918 myclob.setString(1, "TREEs"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1919 // specify second set of params (some (1 and 3 and 5) are left the same) |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1920 cstmt.setDouble(2, 3.02); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1921 cstmt.setString(4, "Tree"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1922 try { |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1923 cstmt.setURL(6, new java.net.URL("https://www.monetdb.org/")); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1924 } catch (java.net.MalformedURLException mfue) { |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1925 sb.append("Invalid URL: ").append(mfue.getMessage()).append("\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1926 } |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1927 cstmt.execute(); |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1928 sb.append("Called Prepared procedure (2): ").append(proc_nm).append("\n"); |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1929 // showParams(cstmt); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1930 showTblContents(tbl_nm); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1931 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1932 // specify third set of params (some (1 and 2) are left the same) |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1933 cstmt.setInt(1, 4); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1934 cstmt.setBoolean(3, false); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1935 cstmt.setString(4, "Four"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1936 cstmt.executeUpdate(); |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1937 sb.append("Called Prepared procedure (3): ").append(proc_nm).append("\n"); |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1938 showTblContents(tbl_nm); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1939 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1940 // test setNull() also |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1941 cstmt.setNull(3, Types.BOOLEAN); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1942 cstmt.setNull(5, Types.CLOB); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1943 cstmt.setNull(2, Types.DOUBLE); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1944 cstmt.setNull(4, Types.VARCHAR); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1945 cstmt.setNull(1, Types.INTEGER); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1946 cstmt.executeUpdate(); |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
1947 sb.append("Called Prepared procedure (with NULLs): ").append(proc_nm).append("\n"); |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1948 showTblContents(tbl_nm); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1949 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1950 sb.append("Test completed. Cleanup procedure and table.").append("\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1951 stmt.execute("DROP PROCEDURE IF EXISTS " + proc_nm + ";"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1952 stmt.execute("DROP TABLE IF EXISTS " + tbl_nm + ";"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1953 |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1954 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1955 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1956 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1957 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1958 closeStmtResSet(stmt, null); |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1959 closeStmtResSet(cstmt, null); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
1960 |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1961 compareExpectedOutput("Test_CallableStmt", |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1962 "Created table: tbl6402\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1963 "Created procedure: proc6402\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1964 "Called procedure (1): proc6402\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1965 "Table tbl6402 has 7 columns:\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1966 " tint tdouble tbool tvarchar tclob turl tclen\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1967 " 1 1.1 true one ONE www.monetdb.org 6\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1968 "Prepared Callable procedure: proc6402\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1969 "Called Prepared procedure (1): proc6402\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1970 "pmd. 6 parameters:\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1971 "Param 1\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1972 " nullable 2 (UNKNOWN)\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1973 " signed true\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1974 " precision 32\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1975 " scale 0\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1976 " type 4\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1977 " typename int\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1978 " classname java.lang.Integer\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1979 " mode 1 (IN)\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1980 "Param 2\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1981 " nullable 2 (UNKNOWN)\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1982 " signed true\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1983 " precision 53\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1984 " scale 0\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1985 " type 8\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1986 " typename double\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1987 " classname java.lang.Double\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1988 " mode 1 (IN)\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1989 "Param 3\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1990 " nullable 2 (UNKNOWN)\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1991 " signed false\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1992 " precision 1\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1993 " scale 0\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1994 " type 16\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1995 " typename boolean\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1996 " classname java.lang.Boolean\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1997 " mode 1 (IN)\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1998 "Param 4\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
1999 " nullable 2 (UNKNOWN)\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2000 " signed false\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2001 " precision 15\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2002 " scale 0\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2003 " type 12\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2004 " typename varchar\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2005 " classname java.lang.String\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2006 " mode 1 (IN)\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2007 "Param 5\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2008 " nullable 2 (UNKNOWN)\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2009 " signed false\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2010 " precision 0\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2011 " scale 0\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2012 " type 12\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2013 " typename clob\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2014 " classname java.lang.String\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2015 " mode 1 (IN)\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2016 "Param 6\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2017 " nullable 2 (UNKNOWN)\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2018 " signed false\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2019 " precision 0\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2020 " scale 0\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2021 " type 12\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2022 " typename url\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2023 " classname org.monetdb.jdbc.types.URL\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2024 " mode 1 (IN)\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2025 "Table tbl6402 has 7 columns:\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2026 " tint tdouble tbool tvarchar tclob turl tclen\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2027 " 1 1.1 true one ONE www.monetdb.org 6\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2028 " 2 2.02 true Two TWOs http://www.monetdb.org/ 7\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2029 "Called Prepared procedure (2): proc6402\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2030 "Table tbl6402 has 7 columns:\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2031 " tint tdouble tbool tvarchar tclob turl tclen\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2032 " 1 1.1 true one ONE www.monetdb.org 6\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2033 " 2 2.02 true Two TWOs http://www.monetdb.org/ 7\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2034 " 2 3.02 true Tree TWOs https://www.monetdb.org/ 8\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2035 "Called Prepared procedure (3): proc6402\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2036 "Table tbl6402 has 7 columns:\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2037 " tint tdouble tbool tvarchar tclob turl tclen\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2038 " 1 1.1 true one ONE www.monetdb.org 6\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2039 " 2 2.02 true Two TWOs http://www.monetdb.org/ 7\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2040 " 2 3.02 true Tree TWOs https://www.monetdb.org/ 8\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2041 " 4 3.02 false Four TWOs https://www.monetdb.org/ 8\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2042 "Called Prepared procedure (with NULLs): proc6402\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2043 "Table tbl6402 has 7 columns:\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2044 " tint tdouble tbool tvarchar tclob turl tclen\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2045 " 1 1.1 true one ONE www.monetdb.org 6\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2046 " 2 2.02 true Two TWOs http://www.monetdb.org/ 7\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2047 " 2 3.02 true Tree TWOs https://www.monetdb.org/ 8\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2048 " 4 3.02 false Four TWOs https://www.monetdb.org/ 8\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2049 " null null null null null https://www.monetdb.org/ null\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2050 "Test completed. Cleanup procedure and table.\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2051 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2052 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2053 private void Test_Rbooleans() { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2054 sb.setLength(0); // clear the output log buffer |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2055 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2056 Statement stmt = null; |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2057 ResultSet rs = null; |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2058 try { |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2059 con.setAutoCommit(false); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2060 // >> false: auto commit should be off now |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2061 sb.append("0. false\t").append(con.getAutoCommit()).append("\n"); |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2062 |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2063 stmt = con.createStatement(); |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2064 int updates = stmt.executeUpdate( |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2065 "CREATE TABLE Test_Rbooleans (" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2066 " id int, tiny_int tinyint, small_int smallint, medium_int mediumint, \"integer\" int, big_int bigint," + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2067 " a_real real, a_float float, a_double double, a_decimal decimal(8,2), a_numeric numeric(8)," + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2068 " bool boolean, a_char char(4), b_char char(5), a_varchar varchar(20), PRIMARY KEY (id) )"); |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2069 if (updates != Statement.SUCCESS_NO_INFO) |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2070 sb.append("1a. Expected -2 got ").append(updates).append(" instead\n"); |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2071 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2072 // all falses |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2073 updates = stmt.executeUpdate("INSERT INTO Test_Rbooleans VALUES (1,0,0,0,0,0,0.0,0.0,0.0,0.0,0,false,'fals','false','false')"); |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2074 // all trues |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2075 updates += stmt.executeUpdate("INSERT INTO Test_Rbooleans VALUES (2,1,1,1,1,1,1.0,1.0,1.0,1.0,1,true,'true','true ','true')"); |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2076 // sneakier |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2077 updates += stmt.executeUpdate("INSERT INTO Test_Rbooleans VALUES (3,2,3,4,5,6,7.1,8.2,9.3,10.4,11,true,'TrUe','fAlSe','true/false')"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2078 updates += stmt.executeUpdate("INSERT INTO Test_Rbooleans VALUES (4,2,3,4,5,6,7.1,8.2,9.3,10.4,11,true,'t ','f ','TRUE ')"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2079 if (updates != 4) |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2080 sb.append("1b. Expected 4 got ").append(updates).append(" instead\n"); |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2081 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2082 rs = stmt.executeQuery("SELECT * FROM Test_Rbooleans ORDER BY id ASC"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2083 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2084 // all should give false |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2085 rs.next(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2086 sb.append("1. ").append(rs.getInt("id")).append(", ").append(rs.getBoolean("tiny_int")) |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2087 .append(", ").append(rs.getBoolean("small_int")).append(", ").append(rs.getBoolean("medium_int")) |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2088 .append(", ").append(rs.getBoolean("integer")).append(", ").append(rs.getBoolean("big_int")) |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2089 .append(", ").append(rs.getBoolean("a_real")).append(", ").append(rs.getBoolean("a_double")) |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2090 .append(", ").append(rs.getBoolean("a_decimal")).append(", ").append(rs.getBoolean("a_numeric")) |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2091 .append(", ").append(rs.getBoolean("bool")).append(", ").append(rs.getBoolean("a_char")) |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2092 .append(", ").append(rs.getBoolean("b_char")).append(", ").append(rs.getBoolean("a_varchar")).append("\n"); |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2093 |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2094 // all should give true except the one before last |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2095 rs.next(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2096 sb.append("2. ").append(rs.getInt("id")).append(", ").append(rs.getBoolean("tiny_int")) |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2097 .append(", ").append(rs.getBoolean("small_int")).append(", ").append(rs.getBoolean("medium_int")) |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2098 .append(", ").append(rs.getBoolean("integer")).append(", ").append(rs.getBoolean("big_int")) |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2099 .append(", ").append(rs.getBoolean("a_real")).append(", ").append(rs.getBoolean("a_double")) |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2100 .append(", ").append(rs.getBoolean("a_decimal")).append(", ").append(rs.getBoolean("a_numeric")) |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2101 .append(", ").append(rs.getBoolean("bool")).append(", ").append(rs.getBoolean("a_char")) |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2102 .append(", ").append(rs.getBoolean("b_char")).append(", ").append(rs.getBoolean("a_varchar")).append("\n"); |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2103 |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2104 // should give true for all but the last two |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2105 rs.next(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2106 sb.append("3. ").append(rs.getInt("id")).append(", ").append(rs.getBoolean("tiny_int")) |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2107 .append(", ").append(rs.getBoolean("small_int")).append(", ").append(rs.getBoolean("medium_int")) |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2108 .append(", ").append(rs.getBoolean("integer")).append(", ").append(rs.getBoolean("big_int")) |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2109 .append(", ").append(rs.getBoolean("a_real")).append(", ").append(rs.getBoolean("a_double")) |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2110 .append(", ").append(rs.getBoolean("a_decimal")).append(", ").append(rs.getBoolean("a_numeric")) |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2111 .append(", ").append(rs.getBoolean("bool")).append(", ").append(rs.getBoolean("a_char")) |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2112 .append(", ").append(rs.getBoolean("b_char")).append(", ").append(rs.getBoolean("a_varchar")).append("\n"); |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2113 |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2114 // should give true for all but the last three |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2115 rs.next(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2116 sb.append("4. ").append(rs.getInt("id")).append(", ").append(rs.getBoolean("tiny_int")) |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2117 .append(", ").append(rs.getBoolean("small_int")).append(", ").append(rs.getBoolean("medium_int")) |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2118 .append(", ").append(rs.getBoolean("integer")).append(", ").append(rs.getBoolean("big_int")) |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2119 .append(", ").append(rs.getBoolean("a_real")).append(", ").append(rs.getBoolean("a_double")) |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2120 .append(", ").append(rs.getBoolean("a_decimal")).append(", ").append(rs.getBoolean("a_numeric")) |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2121 .append(", ").append(rs.getBoolean("bool")).append(", ").append(rs.getBoolean("a_char")) |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2122 .append(", ").append(rs.getBoolean("b_char")).append(", ").append(rs.getBoolean("a_varchar")).append("\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2123 rs.next(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2124 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2125 con.rollback(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2126 con.setAutoCommit(true); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2127 // >> true: auto commit was just switched on |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2128 sb.append("0. true\t").append(con.getAutoCommit()).append("\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2129 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2130 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2131 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2132 |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2133 closeStmtResSet(stmt, rs); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2134 |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2135 compareExpectedOutput("Test_Rbooleans", |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2136 "0. false false\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2137 "1. 1, false, false, false, false, false, false, false, false, false, false, false, false, false\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2138 "2. 2, true, true, true, true, true, true, true, true, true, true, true, false, true\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2139 "3. 3, true, true, true, true, true, true, true, true, true, true, true, false, false\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2140 "4. 4, true, true, true, true, true, true, true, true, true, true, false, false, false\n" + |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
2141 "0. true true\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2142 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2143 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2144 private void Test_Rmetadata() { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2145 sb.setLength(0); // clear the output log buffer |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2146 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2147 Statement stmt = null; |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2148 ResultSet rs = null; |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2149 try { |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2150 con.setAutoCommit(false); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2151 // >> false: auto commit should be off now |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2152 sb.append("0. false\t").append(con.getAutoCommit()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2153 |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2154 stmt = con.createStatement(); |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2155 stmt.executeUpdate("CREATE TABLE Test_Rmetadata ( myint int, mydouble double, mybool boolean, myvarchar varchar(15), myclob clob )"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2156 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2157 // all NULLs |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2158 stmt.executeUpdate("INSERT INTO Test_Rmetadata VALUES (NULL, NULL, NULL, NULL, NULL)"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2159 // all filled in |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2160 stmt.executeUpdate("INSERT INTO Test_Rmetadata VALUES (2 , 3.0, true, 'A string', 'bla bla bla')"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2161 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2162 rs = stmt.executeQuery("SELECT * FROM Test_Rmetadata"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2163 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2164 ResultSetMetaData rsmd = rs.getMetaData(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2165 sb.append("0. ").append(rsmd.getColumnCount()).append(" columns:\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2166 for (int col = 1; col <= rsmd.getColumnCount(); col++) { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2167 sb.append("Colnr ").append(col).append(".\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2168 sb.append("\tclassname ").append(rsmd.getColumnClassName(col)).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2169 sb.append("\tdisplaysize ").append(rsmd.getColumnDisplaySize(col)).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2170 sb.append("\tlabel ").append(rsmd.getColumnLabel(col)).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2171 sb.append("\tname ").append(rsmd.getColumnName(col)).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2172 sb.append("\ttype ").append(rsmd.getColumnType(col)).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2173 sb.append("\ttypename ").append(rsmd.getColumnTypeName(col)).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2174 sb.append("\tprecision ").append(rsmd.getPrecision(col)).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2175 sb.append("\tscale ").append(rsmd.getScale(col)).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2176 sb.append("\tcatalogname ").append(rsmd.getCatalogName(col)).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2177 sb.append("\tschemaname ").append(rsmd.getSchemaName(col)).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2178 sb.append("\ttablename ").append(rsmd.getTableName(col)).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2179 sb.append("\tautoincrement ").append(rsmd.isAutoIncrement(col)).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2180 sb.append("\tcasesensitive ").append(rsmd.isCaseSensitive(col)).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2181 sb.append("\tcurrency ").append(rsmd.isCurrency(col)).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2182 sb.append("\tdefwritable ").append(rsmd.isDefinitelyWritable(col)).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2183 sb.append("\tnullable ").append(rsmd.isNullable(col)).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2184 sb.append("\treadonly ").append(rsmd.isReadOnly(col)).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2185 sb.append("\tsearchable ").append(rsmd.isSearchable(col)).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2186 sb.append("\tsigned ").append(rsmd.isSigned(col)).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2187 sb.append("\twritable ").append(rsmd.isWritable(col)).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2188 } |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2189 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2190 for (int i = 6; rs.next(); i++) { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2191 for (int col = 1; col <= rsmd.getColumnCount(); col++) { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2192 Object obj = rs.getObject(col); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2193 String type = rsmd.getColumnClassName(col); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2194 String isInstance = "(null)"; |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2195 if (obj != null && type != null) { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2196 try { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2197 Class<?> c = Class.forName(type); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2198 if (c.isInstance(obj)) { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2199 isInstance = (obj.getClass().getName() + " is an instance of " + type); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2200 } else { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2201 isInstance = (obj.getClass().getName() + " is NOT an instance of " + type); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2202 } |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2203 } catch (ClassNotFoundException e) { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2204 isInstance = "No such class: " + type; |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2205 } |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2206 } |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2207 sb.append(i).append(".\t").append(isInstance).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2208 } |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2209 } |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2210 rs.close(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2211 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2212 con.rollback(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2213 con.setAutoCommit(true); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2214 // >> true: auto commit was just switched on |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2215 sb.append("0. true\t").append(con.getAutoCommit()).append("\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2216 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2217 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2218 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2219 |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2220 closeStmtResSet(stmt, rs); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2221 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2222 compareExpectedOutput("Test_Rmetadata", |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2223 "0. false false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2224 "0. 5 columns:\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2225 "Colnr 1.\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2226 " classname java.lang.Integer\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2227 " displaysize 1\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2228 " label myint\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2229 " name myint\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2230 " type 4\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2231 " typename int\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2232 " precision 10\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2233 " scale 0\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2234 " catalogname null\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2235 " schemaname sys\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2236 " tablename test_rmetadata\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2237 " autoincrement false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2238 " casesensitive false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2239 " currency false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2240 " defwritable false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2241 " nullable 1\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2242 " readonly true\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2243 " searchable true\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2244 " signed true\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2245 " writable false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2246 "Colnr 2.\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2247 " classname java.lang.Double\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2248 " displaysize 24\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2249 " label mydouble\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2250 " name mydouble\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2251 " type 8\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2252 " typename double\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2253 " precision 15\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2254 " scale 0\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2255 " catalogname null\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2256 " schemaname sys\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2257 " tablename test_rmetadata\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2258 " autoincrement false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2259 " casesensitive false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2260 " currency false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2261 " defwritable false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2262 " nullable 1\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2263 " readonly true\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2264 " searchable true\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2265 " signed true\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2266 " writable false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2267 "Colnr 3.\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2268 " classname java.lang.Boolean\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2269 " displaysize 5\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2270 " label mybool\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2271 " name mybool\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2272 " type 16\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2273 " typename boolean\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2274 " precision 1\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2275 " scale 0\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2276 " catalogname null\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2277 " schemaname sys\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2278 " tablename test_rmetadata\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2279 " autoincrement false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2280 " casesensitive false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2281 " currency false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2282 " defwritable false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2283 " nullable 1\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2284 " readonly true\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2285 " searchable true\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2286 " signed false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2287 " writable false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2288 "Colnr 4.\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2289 " classname java.lang.String\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2290 " displaysize 8\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2291 " label myvarchar\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2292 " name myvarchar\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2293 " type 12\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2294 " typename varchar\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2295 " precision 15\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2296 " scale 0\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2297 " catalogname null\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2298 " schemaname sys\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2299 " tablename test_rmetadata\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2300 " autoincrement false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2301 " casesensitive true\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2302 " currency false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2303 " defwritable false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2304 " nullable 1\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2305 " readonly true\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2306 " searchable true\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2307 " signed false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2308 " writable false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2309 "Colnr 5.\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2310 " classname java.lang.String\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2311 " displaysize 11\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2312 " label myclob\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2313 " name myclob\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2314 " type 12\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2315 " typename clob\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2316 " precision 11\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2317 " scale 0\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2318 " catalogname null\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2319 " schemaname sys\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2320 " tablename test_rmetadata\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2321 " autoincrement false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2322 " casesensitive true\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2323 " currency false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2324 " defwritable false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2325 " nullable 1\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2326 " readonly true\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2327 " searchable true\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2328 " signed false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2329 " writable false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2330 "6. (null)\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2331 "6. (null)\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2332 "6. (null)\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2333 "6. (null)\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2334 "6. (null)\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2335 "7. java.lang.Integer is an instance of java.lang.Integer\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2336 "7. java.lang.Double is an instance of java.lang.Double\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2337 "7. java.lang.Boolean is an instance of java.lang.Boolean\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2338 "7. java.lang.String is an instance of java.lang.String\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2339 "7. java.lang.String is an instance of java.lang.String\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2340 "0. true true\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2341 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2342 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2343 private void Test_Rpositioning() { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2344 sb.setLength(0); // clear the output log buffer |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2345 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2346 Statement stmt = null; |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2347 ResultSet rs = null; |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2348 try { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2349 stmt = con.createStatement(); |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2350 // get a one rowed resultset |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2351 rs = stmt.executeQuery("SELECT 1"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2352 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2353 // >> true: we should be before the first result now |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2354 sb.append("1. true\t").append(rs.isBeforeFirst()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2355 // >> false: we're not at the first result |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2356 sb.append("2. false\t").append(rs.isFirst()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2357 // >> true: there is one result, so we can call next once |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2358 sb.append("3. true\t").append(rs.next()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2359 // >> false: we're not before the first row anymore |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2360 sb.append("4. false\t").append(rs.isBeforeFirst()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2361 // >> true: we're at the first result |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2362 sb.append("5. true\t").append(rs.isFirst()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2363 // >> false: we're on the last row |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2364 sb.append("6. false\t").append(rs.isAfterLast()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2365 // >> true: see above |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2366 sb.append("7. true\t").append(rs.isLast()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2367 // >> false: there is one result, so this is it |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2368 sb.append("8. false\t").append(rs.next()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2369 // >> true: yes, we're at the end |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2370 sb.append("9. true\t").append(rs.isAfterLast()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2371 // >> false: no we're one over it |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2372 sb.append("10. false\t").append(rs.isLast()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2373 // >> false: another try to move on should still fail |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2374 sb.append("11. false\t").append(rs.next()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2375 // >> true: and we should stay positioned after the last |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2376 sb.append("12.true\t").append(rs.isAfterLast()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2377 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2378 rs.close(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2379 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2380 // try the same with a scrollable result set |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2381 DatabaseMetaData dbmd = con.getMetaData(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2382 rs = dbmd.getTableTypes(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2383 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2384 // >> true: we should be before the first result now |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2385 sb.append("1. true\t").append(rs.isBeforeFirst()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2386 // >> false: we're not at the first result |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2387 sb.append("2. false\t").append(rs.isFirst()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2388 // >> true: there is one result, so we can call next once |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2389 sb.append("3. true\t").append(rs.next()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2390 // >> false: we're not before the first row anymore |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2391 sb.append("4. false\t").append(rs.isBeforeFirst()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2392 // >> true: we're at the first result |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2393 sb.append("5. true\t").append(rs.isFirst()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2394 // move to last row |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2395 rs.last(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2396 // >> false: we're on the last row |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2397 sb.append("6. false\t").append(rs.isAfterLast()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2398 // >> true: see above |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2399 sb.append("7. true\t").append(rs.isLast()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2400 // >> false: there is one result, so this is it |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2401 sb.append("8. false\t").append(rs.next()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2402 // >> true: yes, we're at the end |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2403 sb.append("9. true\t").append(rs.isAfterLast()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2404 // >> false: no we're one over it |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2405 sb.append("10. false\t").append(rs.isLast()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2406 // >> false: another try to move on should still fail |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2407 sb.append("11. false\t").append(rs.next()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2408 // >> true: and we should stay positioned after the last |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2409 sb.append("12. true\t").append(rs.isAfterLast()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2410 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2411 rs.close(); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2412 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2413 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2414 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2415 |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2416 closeStmtResSet(stmt, rs); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2417 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2418 compareExpectedOutput("Test_Rpositioning", |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2419 "1. true true\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2420 "2. false false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2421 "3. true true\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2422 "4. false false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2423 "5. true true\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2424 "6. false false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2425 "7. true true\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2426 "8. false false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2427 "9. true true\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2428 "10. false false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2429 "11. false false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2430 "12.true true\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2431 "1. true true\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2432 "2. false false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2433 "3. true true\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2434 "4. false false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2435 "5. true true\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2436 "6. false false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2437 "7. true true\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2438 "8. false false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2439 "9. true true\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2440 "10. false false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2441 "11. false false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2442 "12. true true\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2443 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2444 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2445 private void Test_Rsqldata() { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2446 sb.setLength(0); // clear the output log buffer |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2447 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2448 Statement stmt = null; |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2449 ResultSet rs = null; |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2450 ResultSetMetaData rsmd = null; |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2451 |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2452 try { |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2453 con.setAutoCommit(false); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2454 // >> false: auto commit should be off now |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2455 sb.append("0. false\t").append(con.getAutoCommit()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2456 |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2457 stmt = con.createStatement(); |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2458 stmt.executeUpdate("CREATE TABLE Test_Rsqldata ( myinet inet, myurl url )"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2459 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2460 String InsertInto = "INSERT INTO Test_Rsqldata VALUES "; |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2461 // all NULLs |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2462 stmt.executeUpdate(InsertInto + "(NULL, NULL)"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2463 // all filled in |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2464 stmt.executeUpdate(InsertInto + "('172.5.5.5' , 'http://www.monetdb.org/')"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2465 stmt.executeUpdate(InsertInto + "('172.5.5.5/32' , 'http://www.monetdb.org/Home')"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2466 stmt.executeUpdate(InsertInto + "('172.5.5.5/16' , 'http://www.monetdb.org/Home#someanchor')"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2467 stmt.executeUpdate(InsertInto + "('172.5.5.5/26' , 'http://www.monetdb.org/?query=bla')"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2468 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2469 rs = stmt.executeQuery("SELECT * FROM Test_Rsqldata"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2470 rsmd = rs.getMetaData(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2471 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2472 sb.append("0. ").append(rsmd.getColumnCount()).append(" columns:\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2473 for (int col = 1; col <= rsmd.getColumnCount(); col++) { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2474 sb.append(col).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2475 sb.append("\tclassname ").append(rsmd.getColumnClassName(col)).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2476 sb.append("\tcatalogname ").append(rsmd.getCatalogName(col)).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2477 sb.append("\tschemaname ").append(rsmd.getSchemaName(col)).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2478 sb.append("\ttablename ").append(rsmd.getTableName(col)).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2479 sb.append("\tcolumnname ").append(rsmd.getColumnName(col)).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2480 } |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2481 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2482 for (int i = 1; rs.next(); i++) { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2483 for (int col = 1; col <= rsmd.getColumnCount(); col++) { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2484 sb.append(i).append(".\t"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2485 Object x = rs.getObject(col); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2486 if (x == null) { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2487 sb.append("<null>").append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2488 } else { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2489 sb.append(x.toString()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2490 if (x instanceof INET) { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2491 INET inet = (INET)x; |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2492 sb.append("\t").append(inet.getAddress()).append("/").append(inet.getNetmaskBits()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2493 sb.append("\t").append(inet.getInetAddress().toString()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2494 } else if (x instanceof URL) { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2495 URL url = (URL)x; |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2496 sb.append("\t").append(url.getURL().toString()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2497 } |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2498 } |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2499 } |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2500 } |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2501 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2502 rs.close(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2503 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2504 con.rollback(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2505 con.setAutoCommit(true); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2506 // >> true: auto commit was just switched on |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2507 sb.append("0. true\t").append(con.getAutoCommit()).append("\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2508 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2509 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2510 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2511 |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2512 closeStmtResSet(stmt, rs); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2513 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2514 compareExpectedOutput("Test_Rsqldata", |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2515 "0. false false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2516 "0. 2 columns:\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2517 "1\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2518 " classname org.monetdb.jdbc.types.INET\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2519 " catalogname null\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2520 " schemaname sys\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2521 " tablename test_rsqldata\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2522 " columnname myinet\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2523 "2\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2524 " classname org.monetdb.jdbc.types.URL\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2525 " catalogname null\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2526 " schemaname sys\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2527 " tablename test_rsqldata\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2528 " columnname myurl\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2529 "1. <null>\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2530 "1. <null>\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2531 "2. 172.5.5.5\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2532 " 172.5.5.5/32\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2533 " /172.5.5.5\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2534 "2. http://www.monetdb.org/\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2535 " http://www.monetdb.org/\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2536 "3. 172.5.5.5\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2537 " 172.5.5.5/32\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2538 " /172.5.5.5\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2539 "3. http://www.monetdb.org/Home\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2540 " http://www.monetdb.org/Home\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2541 "4. 172.5.5.5/16\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2542 " 172.5.5.5/16\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2543 " /172.5.5.5\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2544 "4. http://www.monetdb.org/Home#someanchor\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2545 " http://www.monetdb.org/Home#someanchor\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2546 "5. 172.5.5.5/26\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2547 " 172.5.5.5/26\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2548 " /172.5.5.5\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2549 "5. http://www.monetdb.org/?query=bla\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2550 " http://www.monetdb.org/?query=bla\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2551 "0. true true\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2552 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2553 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2554 private void Test_Rtimedate() { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2555 sb.setLength(0); // clear the output log buffer |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2556 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2557 Statement stmt = null; |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2558 ResultSet rs = null; |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2559 try { |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2560 con.setAutoCommit(false); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2561 // >> false: auto commit should be off now |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2562 sb.append("0. false\t").append(con.getAutoCommit()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2563 |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2564 stmt = con.createStatement(); |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2565 stmt.executeUpdate("CREATE TABLE table_Test_Rtimedate ( id int PRIMARY KEY, ts timestamp, t time, d date, vc varchar(30) )"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2566 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2567 stmt.executeUpdate("INSERT INTO table_Test_Rtimedate(id, ts) VALUES (1, timestamp '2004-04-24 11:43:53.123')"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2568 stmt.executeUpdate("INSERT INTO table_Test_Rtimedate(id, t) VALUES (2, time '11:43:53.123')"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2569 stmt.executeUpdate("INSERT INTO table_Test_Rtimedate(id, d) VALUES (3, date '2004-04-24')"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2570 // same values but now as strings to test string to timestamp / time / date object conversions |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2571 stmt.executeUpdate("INSERT INTO table_Test_Rtimedate(id, vc) VALUES (4, '2004-04-24 11:43:53.654321')"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2572 stmt.executeUpdate("INSERT INTO table_Test_Rtimedate(id, vc) VALUES (5, '11:43:53')"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2573 stmt.executeUpdate("INSERT INTO table_Test_Rtimedate(id, vc) VALUES (6, '2004-04-24')"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2574 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2575 // test also with small years (< 1000) (see bug 6468) |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2576 stmt.executeUpdate("INSERT INTO table_Test_Rtimedate(id, ts) VALUES (11, timestamp '904-04-24 11:43:53.567')"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2577 stmt.executeUpdate("INSERT INTO table_Test_Rtimedate(id, ts) VALUES (12, timestamp '74-04-24 11:43:53.567')"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2578 stmt.executeUpdate("INSERT INTO table_Test_Rtimedate(id, ts) VALUES (13, timestamp '4-04-24 11:43:53.567')"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2579 stmt.executeUpdate("INSERT INTO table_Test_Rtimedate(id, d) VALUES (14, date '904-04-24')"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2580 stmt.executeUpdate("INSERT INTO table_Test_Rtimedate(id, d) VALUES (15, date '74-04-24')"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2581 stmt.executeUpdate("INSERT INTO table_Test_Rtimedate(id, d) VALUES (16, date '4-04-24')"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2582 stmt.executeUpdate("INSERT INTO table_Test_Rtimedate(id, vc) VALUES (17, '904-04-24 11:43:53.567')"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2583 stmt.executeUpdate("INSERT INTO table_Test_Rtimedate(id, vc) VALUES (18, '74-04-24 11:43:53.567')"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2584 stmt.executeUpdate("INSERT INTO table_Test_Rtimedate(id, vc) VALUES (19, '4-04-24 11:43:53.567')"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2585 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2586 // test also with negative years (see bug 6468) |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2587 stmt.executeUpdate("INSERT INTO table_Test_Rtimedate(id, ts) VALUES (21, timestamp '-4-04-24 11:43:53.567')"); // negative year |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2588 stmt.executeUpdate("INSERT INTO table_Test_Rtimedate(id, ts) VALUES (22, timestamp '-2004-04-24 11:43:53.567')"); // negative year |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2589 stmt.executeUpdate("INSERT INTO table_Test_Rtimedate(id, d) VALUES (23, date '-4-04-24')"); // negative year |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2590 stmt.executeUpdate("INSERT INTO table_Test_Rtimedate(id, d) VALUES (24, date '-3004-04-24')"); // negative year |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2591 stmt.executeUpdate("INSERT INTO table_Test_Rtimedate(id, vc) VALUES (25, '-2004-04-24 11:43:53.654321')"); // negative year |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2592 stmt.executeUpdate("INSERT INTO table_Test_Rtimedate(id, vc) VALUES (26, '-3004-04-24')"); // negative year |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2593 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2594 rs = stmt.executeQuery("SELECT * FROM table_Test_Rtimedate"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2595 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2596 readNextRow(rs, 1, "ts"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2597 readNextRow(rs, 2, "t"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2598 readNextRow(rs, 3, "d"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2599 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2600 readNextRow(rs, 4, "vc"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2601 readNextRow(rs, 5, "vc"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2602 readNextRow(rs, 6, "vc"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2603 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2604 readNextRow(rs, 11, "ts"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2605 readNextRow(rs, 12, "ts"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2606 readNextRow(rs, 13, "ts"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2607 readNextRow(rs, 14, "d"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2608 readNextRow(rs, 15, "d"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2609 readNextRow(rs, 16, "d"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2610 readNextRow(rs, 17, "vc"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2611 readNextRow(rs, 18, "vc"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2612 readNextRow(rs, 19, "vc"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2613 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2614 readNextRow(rs, 21, "ts"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2615 readNextRow(rs, 22, "ts"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2616 readNextRow(rs, 23, "d"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2617 readNextRow(rs, 24, "d"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2618 readNextRow(rs, 25, "vc"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2619 readNextRow(rs, 26, "vc"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2620 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2621 readWarnings(stmt.getWarnings()); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2622 readWarnings(con.getWarnings()); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2623 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2624 con.rollback(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2625 con.setAutoCommit(true); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2626 // >> true: auto commit should be on by default |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2627 sb.append("0. true\t").append(con.getAutoCommit()).append("\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2628 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2629 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2630 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2631 |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2632 closeStmtResSet(stmt, rs); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2633 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2634 compareExpectedOutput("Test_Rtimedate", |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2635 "0. false false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2636 "1. ts 2004-04-24 11:43:53.123000 to ts: 2004-04-24 11:43:53.123\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2637 "1. ts 2004-04-24 11:43:53.123000 to tm: 11:43:53\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2638 "1. ts 2004-04-24 11:43:53.123000 to dt: 2004-04-24\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2639 "2. t 11:43:53 to ts: 1970-01-01 11:43:53.0\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2640 "2. t 11:43:53 to tm: 11:43:53\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2641 "2. t 11:43:53 to dt: 1970-01-01\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2642 "3. d 2004-04-24 to ts: 2004-04-24 00:00:00.0\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2643 "3. d 2004-04-24 to tm: 00:00:00\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2644 "3. d 2004-04-24 to dt: 2004-04-24\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2645 "4. vc 2004-04-24 11:43:53.654321 to ts: 2004-04-24 11:43:53.654321\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2646 "rs.getTime(colnm) failed with error: parsing failed, found: '-' in: \"2004-04-24 11:43:53.654321\" at pos: 5\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2647 "4. vc 2004-04-24 11:43:53.654321 to dt: 2004-04-24\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2648 "rs.getTimestamp(colnm) failed with error: parsing failed, found: ':' in: \"11:43:53\" at pos: 3\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2649 "5. vc 11:43:53 to tm: 11:43:53\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2650 "rs.getDate(colnm) failed with error: parsing failed, found: ':' in: \"11:43:53\" at pos: 3\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2651 "6. vc 2004-04-24 to ts: 2004-04-24 00:00:00.0\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2652 "rs.getTime(colnm) failed with error: parsing failed, found: '-' in: \"2004-04-24\" at pos: 5\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2653 "6. vc 2004-04-24 to dt: 2004-04-24\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2654 "11. ts 904-04-24 11:43:53.567000 to ts: 0904-04-24 11:43:53.567\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2655 "11. ts 904-04-24 11:43:53.567000 to tm: 11:43:53\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2656 "11. ts 904-04-24 11:43:53.567000 to dt: 0904-04-24\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2657 "12. ts 74-04-24 11:43:53.567000 to ts: 0074-04-24 11:43:53.567\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2658 "12. ts 74-04-24 11:43:53.567000 to tm: 11:43:53\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2659 "12. ts 74-04-24 11:43:53.567000 to dt: 0074-04-24\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2660 "13. ts 4-04-24 11:43:53.567000 to ts: 0004-04-24 11:43:53.567\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2661 "13. ts 4-04-24 11:43:53.567000 to tm: 11:43:53\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2662 "13. ts 4-04-24 11:43:53.567000 to dt: 0004-04-24\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2663 "14. d 904-04-24 to ts: 0904-04-24 00:00:00.0\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2664 "14. d 904-04-24 to tm: 00:00:00\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2665 "14. d 904-04-24 to dt: 0904-04-24\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2666 "15. d 74-04-24 to ts: 0074-04-24 00:00:00.0\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2667 "15. d 74-04-24 to tm: 00:00:00\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2668 "15. d 74-04-24 to dt: 0074-04-24\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2669 "16. d 4-04-24 to ts: 0004-04-24 00:00:00.0\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2670 "16. d 4-04-24 to tm: 00:00:00\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2671 "16. d 4-04-24 to dt: 0004-04-24\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2672 "17. vc 904-04-24 11:43:53.567 to ts: 0904-04-24 11:43:53.567\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2673 "rs.getTime(colnm) failed with error: parsing failed, found: '-' in: \"904-04-24 11:43:53.567\" at pos: 4\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2674 "17. vc 904-04-24 11:43:53.567 to dt: 0904-04-24\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2675 "18. vc 74-04-24 11:43:53.567 to ts: 0074-04-24 11:43:53.567\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2676 "rs.getTime(colnm) failed with error: parsing failed, found: '-' in: \"74-04-24 11:43:53.567\" at pos: 3\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2677 "18. vc 74-04-24 11:43:53.567 to dt: 0074-04-24\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2678 "19. vc 4-04-24 11:43:53.567 to ts: 0004-04-24 11:43:53.567\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2679 "rs.getTime(colnm) failed with error: parsing failed, found: '-' in: \"4-04-24 11:43:53.567\" at pos: 2\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2680 "19. vc 4-04-24 11:43:53.567 to dt: 0004-04-24\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2681 "21. ts -4-04-24 11:43:53.567000 to ts: 0004-04-24 11:43:53.567\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2682 "21. ts -4-04-24 11:43:53.567000 to tm: 11:43:53\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2683 "21. ts -4-04-24 11:43:53.567000 to dt: 0004-04-24\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2684 "22. ts -2004-04-24 11:43:53.567000 to ts: 2004-04-24 11:43:53.567\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2685 "22. ts -2004-04-24 11:43:53.567000 to tm: 11:43:53\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2686 "22. ts -2004-04-24 11:43:53.567000 to dt: 2004-04-24\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2687 "23. d -4-04-24 to ts: 0004-04-24 00:00:00.0\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2688 "23. d -4-04-24 to tm: 00:00:00\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2689 "23. d -4-04-24 to dt: 0004-04-24\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2690 "24. d -3004-04-24 to ts: 3004-04-24 00:00:00.0\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2691 "24. d -3004-04-24 to tm: 00:00:00\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2692 "24. d -3004-04-24 to dt: 3004-04-24\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2693 "25. vc -2004-04-24 11:43:53.654321 to ts: 2004-04-24 11:43:53.654321\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2694 "rs.getTime(colnm) failed with error: parsing failed, found: '-' in: \"-2004-04-24 11:43:53.654321\" at pos: 6\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2695 "25. vc -2004-04-24 11:43:53.654321 to dt: 2004-04-24\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2696 "26. vc -3004-04-24 to ts: 3004-04-24 00:00:00.0\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2697 "rs.getTime(colnm) failed with error: parsing failed, found: '-' in: \"-3004-04-24\" at pos: 6\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2698 "26. vc -3004-04-24 to dt: 3004-04-24\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2699 "0. true true\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2700 } |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2701 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2702 private void readNextRow(ResultSet rs, int rowseq, String colnm) throws SQLException { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2703 rs.next(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2704 readWarnings(rs.getWarnings()); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2705 rs.clearWarnings(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2706 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2707 // fetch the column value using multiple methods: getString(), getTimestamp(), getTime() and getDate() |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2708 // to test proper conversion and error reporting |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2709 String data = rs.getString("id") + ". " + colnm + " " + rs.getString(colnm) + " to "; |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2710 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2711 // getTimestamp() may raise a conversion warning when the value is of type Time or a String which doesn't match format yyyy-mm-dd hh:mm:ss |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2712 try { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2713 sb.append(data + "ts: " + rs.getTimestamp(colnm)).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2714 } catch (SQLException e) { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2715 sb.append("rs.getTimestamp(colnm) failed with error: ").append(e.getMessage()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2716 } |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2717 readWarnings(rs.getWarnings()); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2718 rs.clearWarnings(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2719 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2720 // getTime() may raise a conversion warning when the value is of type Date or a String which doesn't match format hh:mm:ss |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2721 try { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2722 sb.append(data + "tm: " + rs.getTime(colnm)).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2723 } catch (SQLException e) { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2724 sb.append("rs.getTime(colnm) failed with error: ").append(e.getMessage()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2725 } |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2726 readWarnings(rs.getWarnings()); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2727 rs.clearWarnings(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2728 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2729 // getDate() may raise a conversion warning when the value is of type Time or a String which doesn't match format yyyy-mm-dd |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2730 try { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2731 sb.append(data + "dt: " + rs.getDate(colnm)).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2732 } catch (SQLException e) { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2733 sb.append("rs.getDate(colnm) failed with error: ").append(e.getMessage()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2734 } |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2735 readWarnings(rs.getWarnings()); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2736 rs.clearWarnings(); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2737 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2738 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2739 private void Test_Sbatching() { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2740 sb.setLength(0); // clear the output log buffer |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2741 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2742 Statement stmt = null; |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2743 PreparedStatement pstmt = null; |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2744 ResultSet rs = null; |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2745 try { |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2746 con.setAutoCommit(false); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2747 // >> false: auto commit should be off now |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2748 sb.append("0. false\t").append(con.getAutoCommit()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2749 |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2750 stmt = con.createStatement(); |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2751 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2752 sb.append("1. create..."); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2753 if (stmt.executeUpdate("CREATE TABLE Test_Sbatching ( id int )") != Statement.SUCCESS_NO_INFO) |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2754 sb.append("Wrong return status\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2755 else |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2756 sb.append("passed\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2757 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2758 // start batching a large amount of inserts |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2759 for (int i = 1; i <= 3432; i++) { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2760 stmt.addBatch("INSERT INTO Test_Sbatching VALUES (" + i + ")"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2761 if (i % 1500 == 0) { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2762 sb.append("2. executing batch (1500 inserts)..."); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2763 int[] cnts = stmt.executeBatch(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2764 sb.append("passed\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2765 sb.append("3. checking number of update counts..."); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2766 if (cnts.length != 1500) |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2767 sb.append("Invalid size: ").append(cnts.length); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2768 sb.append(cnts.length).append(" passed\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2769 sb.append("4. checking update counts (should all be 1)..."); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2770 for (int j = 0; j < cnts.length; j++) { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2771 if (cnts[j] != 1) |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2772 sb.append("Unexpected value: ").append(cnts[j]); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2773 } |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2774 sb.append("passed\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2775 con.commit(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2776 } |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2777 } |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2778 sb.append("5. executing final batch..."); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2779 stmt.executeBatch(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2780 con.commit(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2781 sb.append("passed\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2782 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2783 pstmt = con.prepareStatement("INSERT INTO Test_Sbatching VALUES (?)"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2784 // start batching a large amount of prepared inserts using JDBC 4.2 executeLargeBatch() |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2785 for (int i = 1; i <= 3568; i++) { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2786 pstmt.setInt(1, i); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2787 pstmt.addBatch(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2788 if (i % 3000 == 0) { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2789 sb.append("2. executing batch (3000 inserts)..."); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2790 long[] cnts = pstmt.executeLargeBatch(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2791 sb.append("passed\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2792 sb.append("3. checking number of update counts..."); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2793 if (cnts.length != 3000) |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2794 sb.append("Invalid size: ").append(cnts.length); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2795 sb.append(cnts.length).append(" passed\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2796 sb.append("4. checking update counts (should all be 1)..."); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2797 for (int j = 0; j < cnts.length; j++) { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2798 if (cnts[j] != 1) |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2799 sb.append("Unexpected value: ").append(cnts[j]); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2800 } |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2801 sb.append("passed\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2802 con.commit(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2803 } |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2804 } |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2805 sb.append("5. executing final Largebatch..."); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2806 pstmt.executeLargeBatch(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2807 con.commit(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2808 sb.append("passed\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2809 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2810 sb.append("6. clearing the batch..."); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2811 stmt.clearBatch(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2812 pstmt.clearBatch(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2813 sb.append("passed\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2814 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2815 sb.append("7. checking table count..."); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2816 rs = stmt.executeQuery("SELECT COUNT(*) FROM Test_Sbatching"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2817 rs.next(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2818 sb.append(rs.getInt(1)).append(" passed\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2819 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2820 sb.append("8. drop table..."); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2821 if (stmt.executeUpdate("DROP TABLE Test_Sbatching") != Statement.SUCCESS_NO_INFO) |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2822 sb.append("Wrong return status\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2823 else |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2824 sb.append("passed\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2825 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2826 // rs.close(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2827 stmt.close(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2828 pstmt.close(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2829 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2830 con.commit(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2831 con.setAutoCommit(true); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2832 // >> true: auto commit should be on by default |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2833 sb.append("0. true\t").append(con.getAutoCommit()).append("\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2834 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2835 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2836 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2837 |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2838 closeStmtResSet(stmt, rs); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2839 closeStmtResSet(pstmt, null); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2840 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2841 compareExpectedOutput("Test_Sbatching", |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2842 "0. false false\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2843 "1. create...passed\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2844 "2. executing batch (1500 inserts)...passed\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2845 "3. checking number of update counts...1500 passed\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2846 "4. checking update counts (should all be 1)...passed\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2847 "2. executing batch (1500 inserts)...passed\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2848 "3. checking number of update counts...1500 passed\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2849 "4. checking update counts (should all be 1)...passed\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2850 "5. executing final batch...passed\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2851 "2. executing batch (3000 inserts)...passed\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2852 "3. checking number of update counts...3000 passed\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2853 "4. checking update counts (should all be 1)...passed\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2854 "5. executing final Largebatch...passed\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2855 "6. clearing the batch...passed\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2856 "7. checking table count...7000 passed\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2857 "8. drop table...passed\n" + |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2858 "0. true true\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2859 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2860 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2861 private void Test_Smoreresults() { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2862 sb.setLength(0); // clear the output log buffer |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2863 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2864 Statement stmt = null; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2865 try { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2866 // >> true: auto commit should be on by default |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2867 sb.append("0. true\t").append(con.getAutoCommit()).append("\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2868 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2869 stmt = con.createStatement(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2870 sb.append("1. more results?..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2871 if (stmt.getMoreResults() != false || stmt.getUpdateCount() != -1) |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2872 sb.append("more results on an unitialised Statement, how can that be?").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2873 sb.append(" nope :)").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2874 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2875 sb.append("2. SELECT 1..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2876 if (stmt.execute("SELECT 1;") == false) |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2877 sb.append("SELECT 1 returns update or no results").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2878 sb.append(" ResultSet :)").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2879 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2880 sb.append("3. more results?..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2881 if (stmt.getMoreResults() != false || stmt.getUpdateCount() != -1) |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2882 sb.append("more results after SELECT 1 query, how can that be?").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2883 sb.append(" nope :)").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2884 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2885 sb.append("4. even more results?..."); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2886 if (stmt.getMoreResults() != false) |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2887 sb.append("still more results after SELECT 1 query, how can that be?").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2888 sb.append(" nope :)").append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2889 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2890 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2891 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2892 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2893 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2894 closeStmtResSet(stmt, null); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2895 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2896 compareExpectedOutput("Test_Smoreresults", |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2897 "0. true true\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2898 "1. more results?... nope :)\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2899 "2. SELECT 1... ResultSet :)\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2900 "3. more results?... nope :)\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2901 "4. even more results?... nope :)\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2902 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2903 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2904 private void Test_Wrapper() { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2905 sb.setLength(0); // clear the output log buffer |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2906 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2907 try { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2908 final String jdbc_pkg = "java.sql."; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2909 final String monetdb_jdbc_pkg = "org.monetdb.jdbc."; |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2910 |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
2911 sb.append("Auto commit is: ").append(con.getAutoCommit()).append("\n"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2912 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2913 checkIsWrapperFor("Connection", con, jdbc_pkg, "Connection"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2914 checkIsWrapperFor("Connection", con, monetdb_jdbc_pkg, "MonetConnection"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2915 checkIsWrapperFor("Connection", con, jdbc_pkg, "Statement"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2916 checkIsWrapperFor("Connection", con, monetdb_jdbc_pkg, "MonetStatement"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2917 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2918 DatabaseMetaData dbmd = con.getMetaData(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2919 checkIsWrapperFor("DatabaseMetaData", dbmd, jdbc_pkg, "DatabaseMetaData"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2920 checkIsWrapperFor("DatabaseMetaData", dbmd, monetdb_jdbc_pkg, "MonetDatabaseMetaData"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2921 checkIsWrapperFor("DatabaseMetaData", dbmd, jdbc_pkg, "Statement"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2922 checkIsWrapperFor("DatabaseMetaData", dbmd, monetdb_jdbc_pkg, "MonetStatement"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2923 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2924 ResultSet rs = dbmd.getSchemas(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2925 checkIsWrapperFor("ResultSet", rs, jdbc_pkg, "ResultSet"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2926 checkIsWrapperFor("ResultSet", rs, monetdb_jdbc_pkg, "MonetResultSet"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2927 checkIsWrapperFor("ResultSet", rs, jdbc_pkg, "Statement"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2928 checkIsWrapperFor("ResultSet", rs, monetdb_jdbc_pkg, "MonetStatement"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2929 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2930 ResultSetMetaData rsmd = rs.getMetaData(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2931 checkIsWrapperFor("ResultSetMetaData", rsmd, jdbc_pkg, "ResultSetMetaData"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2932 checkIsWrapperFor("ResultSetMetaData", rsmd, monetdb_jdbc_pkg, "MonetResultSet"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2933 checkIsWrapperFor("ResultSetMetaData", rsmd, monetdb_jdbc_pkg, "MonetResultSet$rsmdw"); // it is a private class of MonetResultSet |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2934 checkIsWrapperFor("ResultSetMetaData", rsmd, jdbc_pkg, "Statement"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2935 checkIsWrapperFor("ResultSetMetaData", rsmd, monetdb_jdbc_pkg, "MonetStatement"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2936 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2937 rs.close(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2938 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2939 Statement stmt = con.createStatement(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2940 checkIsWrapperFor("Statement", stmt, jdbc_pkg, "Statement"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2941 checkIsWrapperFor("Statement", stmt, monetdb_jdbc_pkg, "MonetStatement"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2942 checkIsWrapperFor("Statement", stmt, jdbc_pkg, "Connection"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2943 checkIsWrapperFor("Statement", stmt, monetdb_jdbc_pkg, "MonetConnection"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2944 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2945 stmt.close(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2946 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2947 PreparedStatement pstmt = con.prepareStatement("SELECT name FROM sys.tables WHERE system AND name like ?"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2948 checkIsWrapperFor("PreparedStatement", pstmt, jdbc_pkg, "PreparedStatement"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2949 checkIsWrapperFor("PreparedStatement", pstmt, monetdb_jdbc_pkg, "MonetPreparedStatement"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2950 checkIsWrapperFor("PreparedStatement", pstmt, jdbc_pkg, "Statement"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2951 checkIsWrapperFor("PreparedStatement", pstmt, monetdb_jdbc_pkg, "MonetStatement"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2952 checkIsWrapperFor("PreparedStatement", pstmt, jdbc_pkg, "Connection"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2953 checkIsWrapperFor("PreparedStatement", pstmt, monetdb_jdbc_pkg, "MonetConnection"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2954 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2955 ParameterMetaData pmd = pstmt.getParameterMetaData(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2956 checkIsWrapperFor("ParameterMetaData", pmd, jdbc_pkg, "ParameterMetaData"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2957 checkIsWrapperFor("ParameterMetaData", pmd, monetdb_jdbc_pkg, "MonetPreparedStatement"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2958 checkIsWrapperFor("ParameterMetaData", pmd, monetdb_jdbc_pkg, "MonetPreparedStatement$pmdw"); // it is a private class of MonetPreparedStatement |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2959 checkIsWrapperFor("ParameterMetaData", pmd, jdbc_pkg, "Connection"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2960 checkIsWrapperFor("ParameterMetaData", pmd, monetdb_jdbc_pkg, "MonetConnection"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2961 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2962 ResultSetMetaData psrsmd = pstmt.getMetaData(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2963 checkIsWrapperFor("PrepStmt ResultSetMetaData", psrsmd, jdbc_pkg, "ResultSetMetaData"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2964 checkIsWrapperFor("PrepStmt ResultSetMetaData", psrsmd, monetdb_jdbc_pkg, "MonetPreparedStatement"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2965 checkIsWrapperFor("PrepStmt ResultSetMetaData", psrsmd, monetdb_jdbc_pkg, "MonetPreparedStatement$rsmdw"); // it is a private class of MonetPreparedStatement |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2966 checkIsWrapperFor("PrepStmt ResultSetMetaData", psrsmd, jdbc_pkg, "Connection"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2967 checkIsWrapperFor("PrepStmt ResultSetMetaData", psrsmd, monetdb_jdbc_pkg, "MonetConnection"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2968 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2969 pstmt.close(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2970 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2971 } catch (SQLException e) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2972 while ((e = e.getNextException()) != null) |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2973 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2974 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2975 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2976 compareExpectedOutput("Test_Wrapper", "Auto commit is: true\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2977 "Connection. isWrapperFor(Connection) returns: true Called unwrap(). Returned object is not null, so oke\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2978 "Connection. isWrapperFor(MonetConnection) returns: true Called unwrap(). Returned object is not null, so oke\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2979 "Connection. isWrapperFor(Statement) returns: false\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2980 "Connection. isWrapperFor(MonetStatement) returns: false\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2981 "DatabaseMetaData. isWrapperFor(DatabaseMetaData) returns: true Called unwrap(). Returned object is not null, so oke\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2982 "DatabaseMetaData. isWrapperFor(MonetDatabaseMetaData) returns: true Called unwrap(). Returned object is not null, so oke\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2983 "DatabaseMetaData. isWrapperFor(Statement) returns: false\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2984 "DatabaseMetaData. isWrapperFor(MonetStatement) returns: false\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2985 "ResultSet. isWrapperFor(ResultSet) returns: true Called unwrap(). Returned object is not null, so oke\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2986 "ResultSet. isWrapperFor(MonetResultSet) returns: true Called unwrap(). Returned object is not null, so oke\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2987 "ResultSet. isWrapperFor(Statement) returns: false\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2988 "ResultSet. isWrapperFor(MonetStatement) returns: false\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2989 "ResultSetMetaData. isWrapperFor(ResultSetMetaData) returns: true Called unwrap(). Returned object is not null, so oke\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2990 "ResultSetMetaData. isWrapperFor(MonetResultSet) returns: false\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2991 "ResultSetMetaData. isWrapperFor(MonetResultSet$rsmdw) returns: true Called unwrap(). Returned object is not null, so oke\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2992 "ResultSetMetaData. isWrapperFor(Statement) returns: false\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2993 "ResultSetMetaData. isWrapperFor(MonetStatement) returns: false\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2994 "Statement. isWrapperFor(Statement) returns: true Called unwrap(). Returned object is not null, so oke\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2995 "Statement. isWrapperFor(MonetStatement) returns: true Called unwrap(). Returned object is not null, so oke\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2996 "Statement. isWrapperFor(Connection) returns: false\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2997 "Statement. isWrapperFor(MonetConnection) returns: false\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2998 "PreparedStatement. isWrapperFor(PreparedStatement) returns: true Called unwrap(). Returned object is not null, so oke\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
2999 "PreparedStatement. isWrapperFor(MonetPreparedStatement) returns: true Called unwrap(). Returned object is not null, so oke\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3000 "PreparedStatement. isWrapperFor(Statement) returns: true Called unwrap(). Returned object is not null, so oke\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3001 "PreparedStatement. isWrapperFor(MonetStatement) returns: true Called unwrap(). Returned object is not null, so oke\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3002 "PreparedStatement. isWrapperFor(Connection) returns: false\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3003 "PreparedStatement. isWrapperFor(MonetConnection) returns: false\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3004 "ParameterMetaData. isWrapperFor(ParameterMetaData) returns: true Called unwrap(). Returned object is not null, so oke\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3005 "ParameterMetaData. isWrapperFor(MonetPreparedStatement) returns: false\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3006 "ParameterMetaData. isWrapperFor(MonetPreparedStatement$pmdw) returns: true Called unwrap(). Returned object is not null, so oke\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3007 "ParameterMetaData. isWrapperFor(Connection) returns: false\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3008 "ParameterMetaData. isWrapperFor(MonetConnection) returns: false\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3009 "PrepStmt ResultSetMetaData. isWrapperFor(ResultSetMetaData) returns: true Called unwrap(). Returned object is not null, so oke\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3010 "PrepStmt ResultSetMetaData. isWrapperFor(MonetPreparedStatement) returns: false\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3011 "PrepStmt ResultSetMetaData. isWrapperFor(MonetPreparedStatement$rsmdw) returns: true Called unwrap(). Returned object is not null, so oke\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3012 "PrepStmt ResultSetMetaData. isWrapperFor(Connection) returns: false\n" + |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3013 "PrepStmt ResultSetMetaData. isWrapperFor(MonetConnection) returns: false\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3014 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3015 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3016 private void checkIsWrapperFor(String objnm, Wrapper obj, String pkgnm, String classnm) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3017 try { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3018 Class<?> clazz = Class.forName(pkgnm + classnm); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3019 boolean isWrapper = obj.isWrapperFor(clazz); |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
3020 sb.append(objnm).append(". isWrapperFor(").append(classnm).append(") returns: ").append(isWrapper); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3021 if (isWrapper) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3022 Object wobj = obj.unwrap(clazz); |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
3023 sb.append("\tCalled unwrap(). Returned object is ").append((wobj != null ? "not null, so oke" : "null !!")); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3024 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3025 sb.append("\n"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3026 } catch (ClassNotFoundException cnfe) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3027 sb.append(cnfe.toString()); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3028 } catch (SQLException se) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3029 sb.append(se.getMessage()); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3030 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3031 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3032 |
436
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3033 private void Bug_PrepStmtSetString_6382() { |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3034 sb.setLength(0); // clear the output log buffer |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3035 |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3036 Statement stmt = null; |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3037 PreparedStatement pstmt = null; |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3038 ResultSet rs = null; |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3039 final String tableName = "PrepStmtSetString_6382"; |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3040 try { |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3041 // >> true: auto commit should be on by default |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3042 sb.append("0. true\t").append(con.getAutoCommit()).append("\n"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3043 |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3044 stmt = con.createStatement(); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3045 sb.append("1. Creating table " + tableName); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3046 if (stmt.executeUpdate("CREATE TABLE " + tableName + " (myint INT, myvarchar VARCHAR(15), myjson JSON, myuuid UUID, myurl URL, myinet INET)") != Statement.SUCCESS_NO_INFO) |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3047 sb.append("Wrong return status\n"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3048 |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3049 sb.append("\n2. Insert row 1, "); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3050 stmt.executeUpdate("INSERT INTO " + tableName + " VALUES (1, 'row 1', '{}', uuid '34c8deb5-e608-406b-beda-6a951f73d455', 'https://www.monetdb.org/', '128.0.0.1')"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3051 sb.append("2, "); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3052 stmt.executeUpdate("INSERT INTO " + tableName + " VALUES (2, 'row 2', '[]', NULL, NULL, NULL)"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3053 sb.append("3, "); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3054 stmt.executeUpdate("INSERT INTO " + tableName + " VALUES (3, 'row 3', '\"abc\"', NULL, NULL, NULL)"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3055 sb.append("4, "); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3056 stmt.executeUpdate("INSERT INTO " + tableName + " VALUES (4, 'row 4', 'true', NULL, NULL, NULL)"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3057 sb.append("5\n"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3058 stmt.executeUpdate("INSERT INTO " + tableName + " VALUES (5, 'row 5', '-0.123', NULL, NULL, NULL)"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3059 |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3060 sb.append("Creating a prepared statement with 6 parameters and inserting rows using setInt(), setString(), setNull(), setNString(), setURL(), setObject().\n"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3061 pstmt = con.prepareStatement("INSERT INTO " + tableName + " VALUES (?,?, ? ,?,? , ?)"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3062 ParameterMetaData pmd = pstmt.getParameterMetaData(); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3063 int pcount = pmd.getParameterCount(); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3064 sb.append("Prepared Statement has " + pcount + " parameters:" + (pcount != 6 ? " ERROR: Expected 6 parameters!" : "")).append("\n"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3065 for (int p = 1; p <= pcount; p++) { |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3066 sb.append(" Parameter " + p + " type is: " + pmd.getParameterTypeName(p) + ". JDBC SQL type: " + pmd.getParameterType(p)).append("\n"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3067 } |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3068 |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3069 int row = 6; |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3070 pstmt.setInt(1, row); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3071 pstmt.setString(2, "row " + row); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3072 pstmt.setString(3, "{\"menu\": {\n \"id\": \"file\",\n \"value\": \"File\",\n \"popup\": {\n \"menuitem\": [\n {\"value\": \"New\", \"onclick\": \"CreateNewDoc()\"},\n {\"value\": \"Open\", \"onclick\": \"OpenDoc()\"},\n {\"value\": \"Close\", \"onclick\": \"CloseDoc()\"}\n ]\n }\n}}"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3073 pstmt.setNull(4, 0); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3074 pstmt.setNull(5, 0); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3075 pstmt.setNull(6, 0); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3076 sb.append("Inserting row " + row).append("\n"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3077 int inserted = pstmt.executeUpdate(); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3078 sb.append("Inserted " + inserted + " row").append("\n"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3079 |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3080 row++; // row 7 |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3081 pstmt.setShort(1, (short)row); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3082 pstmt.setNString(2, "row " + row); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3083 pstmt.setNull(3, 0); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3084 pstmt.setString(4, "4a148b7d-8d47-4e1e-a21e-09a71abf2215"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3085 sb.append("Inserting row " + row).append("\n"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3086 inserted = pstmt.executeUpdate(); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3087 sb.append("Inserted " + inserted + " row").append("\n"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3088 |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3089 row++; // row 8 |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3090 pstmt.setLong(1, (long)row); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3091 pstmt.setString(2, "row " + row); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3092 pstmt.setObject(3, "+3.1415E-06"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3093 pstmt.setNull(4, 0); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3094 try { |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3095 pstmt.setURL(5, new java.net.URL("https://www.cwi.nl/")); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3096 } catch (java.net.MalformedURLException mfe) { |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3097 sb.append(mfe).append("\n"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3098 } |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3099 sb.append("Inserting row " + row).append("\n"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3100 inserted = pstmt.executeUpdate(); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3101 sb.append("Inserted " + inserted + " row").append("\n"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3102 |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3103 row++; // row 9 |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3104 pstmt.setBigDecimal(1, new java.math.BigDecimal(row)); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3105 pstmt.setNString(2, "row " + row); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3106 pstmt.setNull(5, 0); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3107 pstmt.setString(6, "127.255.255.255"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3108 sb.append("Inserting row " + row).append("\n"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3109 inserted = pstmt.executeUpdate(); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3110 sb.append("Inserted " + inserted + " row").append("\n"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3111 |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3112 /* also test generic setObject(int, String) */ |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3113 row++; // row 10 |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3114 pstmt.setObject(1, Integer.valueOf(row)); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3115 pstmt.setObject(2, "row " + row); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3116 pstmt.setObject(3, "[{\"menu\": {\n \"header\": \"SVG Viewer\",\n \"items\": [\n {\"id\": \"Open\"},\n {\"id\": \"OpenNew\", \"label\": \"Open New\"},\n null,\n {\"id\": \"ZoomIn\", \"label\": \"Zoom In\"},\n {\"id\": \"ZoomOut\", \"label\": \"Zoom Out\"},\n {\"id\": \"OriginalView\", \"label\": \"Original View\"},\n null,\n {\"id\": \"Quality\"},\n {\"id\": \"Pause\"},\n {\"id\": \"Mute\"},\n null,\n {\"id\": \"Help\"},\n {\"id\": \"About\", \"label\": \"About Adobe CVG Viewer...\"}\n ]\n}}]"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3117 pstmt.setObject(4, "b39dc76e-4faf-4fd9-bc1e-17df48acf764"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3118 pstmt.setObject(5, "https://en.wikipedia.org/wiki/IP_address"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3119 pstmt.setObject(6, "223.255.255.255"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3120 sb.append("Inserting row " + row).append("\n"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3121 inserted = pstmt.executeUpdate(); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3122 sb.append("Inserted " + inserted + " row").append("\n"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3123 |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3124 row++; // row 11 |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3125 pstmt.setObject(1, new java.math.BigDecimal(row)); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3126 pstmt.setObject(2, "row " + row); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3127 pstmt.setObject(3, "null"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3128 pstmt.setObject(4, java.util.UUID.fromString("ff125769-b63c-4c3c-859f-5b84a9349e24")); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3129 URL myURL = new URL(); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3130 try { |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3131 myURL.fromString("https://en.wikipedia.org/wiki/IP_address"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3132 pstmt.setObject(5, myURL); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3133 } catch (Exception mfe) { |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3134 sb.append(mfe).append("\n"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3135 } |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3136 INET myINET = new INET(); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3137 myINET.fromString("223.234.245.255"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3138 pstmt.setObject(6, myINET); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3139 sb.append("Inserting row " + row).append("\n"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3140 inserted = pstmt.executeUpdate(); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3141 sb.append("Inserted " + inserted + " row").append("\n"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3142 |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3143 sb.append("List contents of TABLE " + tableName + " after " + row + " rows inserted").append("\n"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3144 rs = stmt.executeQuery("SELECT * FROM " + tableName + " ORDER BY 1"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3145 ResultSetMetaData rsmd = rs.getMetaData(); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3146 int colcount = rsmd.getColumnCount(); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3147 sb.append("Query has " + colcount + " output columns." + (colcount != 6 ? " ERROR: Expected 6 columns!" : "")).append("\n"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3148 row = 0; |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3149 while (rs.next()) { |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3150 sb.append("row " + ++row); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3151 for (int c = 1; c <= colcount; c++) { |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3152 sb.append("\t" + rs.getString(c)); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3153 } |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3154 sb.append("\n"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3155 } |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3156 } catch (SQLException e) { |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3157 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3158 } |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3159 |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3160 try { |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3161 sb.append("Cleanup TABLE " + tableName).append("\n"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3162 stmt.executeUpdate("DROP TABLE " + tableName); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3163 } catch (SQLException e) { |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3164 sb.append("FAILED: ").append(e.getMessage()).append("\n"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3165 } |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3166 |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3167 closeStmtResSet(stmt, rs; |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3168 closeStmtResSet(pstmt, null); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3169 |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3170 compareExpectedOutput("Bug_PrepStmtSetString_6382", |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3171 "0. true true\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3172 "1. Creating table PrepStmtSetString_6382\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3173 "2. Insert row 1, 2, 3, 4, 5\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3174 "Creating a prepared statement with 6 parameters and inserting rows using setInt(), setString(), setNull(), setNString(), setURL(), setObject().\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3175 "Prepared Statement has 6 parameters:\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3176 " Parameter 1 type is: int. JDBC SQL type: 4\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3177 " Parameter 2 type is: varchar. JDBC SQL type: 12\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3178 " Parameter 3 type is: json. JDBC SQL type: 12\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3179 " Parameter 4 type is: uuid. JDBC SQL type: 12\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3180 " Parameter 5 type is: url. JDBC SQL type: 12\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3181 " Parameter 6 type is: inet. JDBC SQL type: 12\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3182 "Inserting row 6\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3183 "Inserted 1 row\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3184 "Inserting row 7\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3185 "Inserted 1 row\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3186 "Inserting row 8\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3187 "Inserted 1 row\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3188 "Inserting row 9\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3189 "Inserted 1 row\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3190 "Inserting row 10\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3191 "Inserted 1 row\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3192 "Inserting row 11\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3193 "Inserted 1 row\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3194 "List contents of TABLE PrepStmtSetString_6382 after 11 rows inserted\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3195 "Query has 6 output columns.\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3196 "row 1 1 row 1 {} 34c8deb5-e608-406b-beda-6a951f73d455 https://www.monetdb.org/ 128.0.0.1\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3197 "row 2 2 row 2 [] null null null\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3198 "row 3 3 row 3 \"abc\" null null null\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3199 "row 4 4 row 4 true null null null\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3200 "row 5 5 row 5 -0.123 null null null\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3201 "row 6 6 row 6 {\"menu\": {\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3202 " \"id\": \"file\",\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3203 " \"value\": \"File\",\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3204 " \"popup\": {\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3205 " \"menuitem\": [\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3206 " {\"value\": \"New\", \"onclick\": \"CreateNewDoc()\"},\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3207 " {\"value\": \"Open\", \"onclick\": \"OpenDoc()\"},\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3208 " {\"value\": \"Close\", \"onclick\": \"CloseDoc()\"}\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3209 " ]\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3210 " }\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3211 "}} null null null\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3212 "row 7 7 row 7 null 4a148b7d-8d47-4e1e-a21e-09a71abf2215 null null\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3213 "row 8 8 row 8 +3.1415E-06 null https://www.cwi.nl/ null\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3214 "row 9 9 row 9 +3.1415E-06 null null 127.255.255.255\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3215 "row 10 10 row 10 [{\"menu\": {\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3216 " \"header\": \"SVG Viewer\",\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3217 " \"items\": [\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3218 " {\"id\": \"Open\"},\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3219 " {\"id\": \"OpenNew\", \"label\": \"Open New\"},\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3220 " null,\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3221 " {\"id\": \"ZoomIn\", \"label\": \"Zoom In\"},\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3222 " {\"id\": \"ZoomOut\", \"label\": \"Zoom Out\"},\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3223 " {\"id\": \"OriginalView\", \"label\": \"Original View\"},\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3224 " null,\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3225 " {\"id\": \"Quality\"},\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3226 " {\"id\": \"Pause\"},\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3227 " {\"id\": \"Mute\"},\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3228 " null,\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3229 " {\"id\": \"Help\"},\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3230 " {\"id\": \"About\", \"label\": \"About Adobe CVG Viewer...\"}\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3231 " ]\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3232 "}}] b39dc76e-4faf-4fd9-bc1e-17df48acf764 https://en.wikipedia.org/wiki/IP_address 223.255.255.255\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3233 "row 11 11 row 11 null ff125769-b63c-4c3c-859f-5b84a9349e24 https://en.wikipedia.org/wiki/IP_address 223.234.245.255\n" + |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3234 "Cleanup TABLE PrepStmtSetString_6382\n"); |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3235 } |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3236 |
b32946647c77
Extended PreparedStatement.setString() json string validity test for json parameters to now also accept: numbers (with optional fractions and exponent), string literals between double quotes, and keywords: true, false and null.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
427
diff
changeset
|
3237 |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3238 // some private utility methods for showing table content and params meta data |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3239 private void showTblContents(String tblnm) { |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3240 Statement stmt = null; |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3241 ResultSet rs = null; |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3242 try { |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3243 stmt = con.createStatement(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3244 rs = stmt.executeQuery("SELECT * FROM " + tblnm); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3245 if (rs != null) { |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3246 ResultSetMetaData rsmd = rs.getMetaData(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3247 sb.append("Table ").append(tblnm).append(" has ").append(rsmd.getColumnCount()).append(" columns:").append("\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3248 for (int col = 1; col <= rsmd.getColumnCount(); col++) { |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3249 sb.append("\t").append(rsmd.getColumnLabel(col)); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3250 } |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3251 sb.append("\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3252 while (rs.next()) { |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3253 for (int col = 1; col <= rsmd.getColumnCount(); col++) { |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3254 sb.append("\t").append(rs.getString(col)); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3255 } |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3256 sb.append("\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3257 } |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3258 } else |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3259 sb.append("failed to execute query: SELECT * FROM ").append(tblnm).append("\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3260 } catch (SQLException e) { |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
3261 sb.append("showContents failed: ").append(e.getMessage()).append("\n"); |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3262 } |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3263 closeStmtResSet(stmt, rs); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3264 } |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3265 |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3266 private void showParams(PreparedStatement pstmt) { |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3267 try { |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3268 // testing and showing parameter meta data |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3269 ParameterMetaData pmd = pstmt.getParameterMetaData(); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3270 sb.append("pmd. ").append(pmd.getParameterCount()).append(" parameters:\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3271 for (int parm = 1; parm <= pmd.getParameterCount(); parm++) { |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3272 sb.append("Param ").append(parm).append("\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3273 int nullable = pmd.isNullable(parm); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3274 sb.append(" nullable ").append(nullable).append(" ("); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3275 switch (nullable) { |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3276 case ParameterMetaData.parameterNoNulls: sb.append("NO"); break; |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3277 case ParameterMetaData.parameterNullable: sb.append("YA"); break; |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3278 case ParameterMetaData.parameterNullableUnknown: sb.append("UNKNOWN"); break; |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
3279 default: sb.append("INVALID ").append(nullable); break; |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3280 } |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3281 sb.append(")\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3282 sb.append(" signed ").append(pmd.isSigned(parm)).append("\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3283 sb.append(" precision ").append(pmd.getPrecision(parm)).append("\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3284 sb.append(" scale ").append(pmd.getScale(parm)).append("\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3285 sb.append(" type ").append(pmd.getParameterType(parm)).append("\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3286 sb.append(" typename ").append(pmd.getParameterTypeName(parm)).append("\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3287 sb.append(" classname ").append(pmd.getParameterClassName(parm)).append("\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3288 int mode = pmd.getParameterMode(parm); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3289 sb.append(" mode ").append(mode).append(" ("); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3290 switch (mode) { |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3291 case ParameterMetaData.parameterModeIn: sb.append("IN"); break; |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3292 case ParameterMetaData.parameterModeInOut: sb.append("INOUT"); break; |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3293 case ParameterMetaData.parameterModeOut: sb.append("OUT"); break; |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3294 case ParameterMetaData.parameterModeUnknown: sb.append("UNKNOWN"); break; |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
3295 default: sb.append("INVALID ").append(mode); break; |
401
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3296 } |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3297 sb.append(")\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3298 } |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3299 } catch (SQLException e) { |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3300 sb.append("showParams() FAILED: ").append(e.getMessage()).append("\n"); |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3301 } |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3302 } |
1850e0dfb5f7
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
400
diff
changeset
|
3303 |
404
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
3304 private void readExceptions(SQLException e) { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
3305 while (e != null) { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
3306 sb.append("Exception: ").append(e.toString()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
3307 e = e.getNextException(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
3308 } |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
3309 } |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
3310 |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
3311 private void readWarnings(SQLWarning w) { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
3312 while (w != null) { |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
3313 sb.append("Warning: ").append(w.toString()).append("\n"); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
3314 w = w.getNextWarning(); |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
3315 } |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
3316 } |
559aa626b550
Improved code and implemented all tests.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
401
diff
changeset
|
3317 |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3318 private void compareExpectedOutput(String testname, String expected) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3319 if (!expected.equals(sb.toString())) { |
400
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
3320 System.out.print("Test '"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
3321 System.out.print(testname); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
3322 if (!testname.endsWith(")")) |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
3323 System.out.print("()"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
3324 System.out.println("' produced different output!"); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
3325 System.out.println("Expected:"); |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3326 System.out.println(expected); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3327 System.out.println("Gotten:"); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3328 System.out.println(sb); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3329 System.out.println(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3330 } |
400
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
3331 if (sb.length() > sbInitLen) { |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
3332 System.out.println("Test '" + testname |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
3333 + "' produced output > " + sbInitLen |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
3334 + " chars! Enlarge sbInitLen to: " + sb.length()); |
20bdae942f99
Implemented some more tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
399
diff
changeset
|
3335 } |
395
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3336 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3337 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3338 private void closeConx(Connection cn) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3339 if (cn != null) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3340 try { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3341 cn.close(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3342 } catch (SQLException e) { /* ignore */ } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3343 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3344 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3345 |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3346 private void closeStmtResSet(Statement st, ResultSet rs) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3347 if (rs != null) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3348 try { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3349 rs.close(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3350 } catch (SQLException e) { /* ignore */ } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3351 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3352 if (st != null) { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3353 try { |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3354 st.close(); |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3355 } catch (SQLException e) { /* ignore */ } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3356 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3357 } |
0eef53e06007
Add JDBC_API_Tester program to test JDBC Driver API methods and behavior of MonetDB server.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff
changeset
|
3358 } |