annotate tests/BugResultSetMetaData_Bug_6183.java @ 261:d4baf8a4b43a

Update Copyright year to 2019
author Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
date Thu, 03 Jan 2019 14:43:44 +0100 (2019-01-03)
parents 37b537a7ad60
children 54137aeb1f92
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
104
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
1 /*
839ffec1d36d Fix for bug 6183.
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
839ffec1d36d Fix for bug 6183.
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
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
5 *
261
d4baf8a4b43a Update Copyright year to 2019
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 256
diff changeset
6 * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
104
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
7 */
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
8
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
9 import java.sql.*;
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
10
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
11 public class BugResultSetMetaData_Bug_6183 {
119
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
12 static final String dqTblName = "\"my dq_table\"";
121
65b27b29ca71 Extending test with 3 additional columns.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 119
diff changeset
13 static final String[] dqColNames = { "\"my space\"", "\"my, comma_space\"", "\"my$dollar\"", "\"my#hash\"", "\"my tab\""
256
37b537a7ad60 Use column names that are actually standard SQL.
Sjoerd Mullender <sjoerd@acm.org>
parents: 200
diff changeset
14 , "\"my ,tab_comma\"", "\"my, comma_tab\"", "\"my\"\"double_doublequote\"", "\"Abc\"", "\" \"", "\"123\"" };
119
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
15
104
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
16 public static void main(String[] args) throws Exception {
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
17 // Class.forName("nl.cwi.monetdb.jdbc.MonetDriver"); // not needed anymore for self registering JDBC drivers
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
18 Connection con = DriverManager.getConnection(args[0]);
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
19 Statement stmt = con.createStatement();
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
20 ResultSet rs = null;
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
21 try {
119
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
22 System.out.println("1. create table " + dqTblName);
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
23 StringBuilder sb = new StringBuilder(30 + (dqColNames.length * (30 + 15)));
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
24 sb.append("CREATE TABLE ").append(dqTblName).append(" (");
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
25 for (int n = 0; n < dqColNames.length; n++) {
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
26 sb.append(dqColNames[n]);
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
27 sb.append(" varchar(").append(31 + n).append(')');
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
28 if (n < (dqColNames.length -1))
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
29 sb.append(", ");
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
30 }
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
31 sb.append(')');
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
32 int ret = stmt.executeUpdate(sb.toString());
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
33 System.out.println(" returned: " + ret + " (expected -2)");
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
34 System.out.println();
104
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
35
119
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
36 String tblName = dqTblName.substring(1, dqTblName.length() -1); // trim the leading and trailing double quote characters
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
37 System.out.println("2. show column names of this new table (" + tblName + ") via sys.columns query");
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
38 rs = stmt.executeQuery("SELECT number, name, type from sys.columns where table_id in (select id from sys._tables where name = '" + tblName + "') order by number");
104
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
39 showResultAndClose(rs);
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
40
119
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
41 System.out.println("3. insert 1 row of data with values same as column names");
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
42 sb.setLength(0);
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
43 sb.append("INSERT INTO ").append(dqTblName).append(" VALUES (");
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
44 for (int n = 0; n < dqColNames.length; n++) {
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
45 sb.append('\'');
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
46 sb.append(dqColNames[n]);
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
47 sb.append('\'');
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
48 if (n < (dqColNames.length -1))
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
49 sb.append(", ");
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
50 }
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
51 sb.append(')');
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
52 ret = stmt.executeUpdate(sb.toString());
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
53 System.out.println(" returned: " + ret + " (expected 1)");
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
54 System.out.println();
104
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
55
119
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
56 System.out.println("4. insert 1 row of data with values same as column names but without enclosing double quotes");
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
57 sb.setLength(0);
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
58 sb.append("INSERT INTO ").append(dqTblName).append(" VALUES (");
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
59 for (int n = 0; n < dqColNames.length; n++) {
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
60 sb.append('\'');
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
61 // remove enclosing double quotes
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
62 sb.append(dqColNames[n].substring(1, dqColNames[n].length() -1));
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
63 sb.append('\'');
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
64 if (n < (dqColNames.length -1))
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
65 sb.append(", ");
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
66 }
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
67 sb.append(')');
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
68 ret = stmt.executeUpdate(sb.toString());
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
69 System.out.println(" returned: " + ret + " (expected 1)");
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
70 System.out.println();
104
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
71
119
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
72 // query each column separately
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
73 for (int n = 0; n < dqColNames.length; n++) {
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
74 executeQueryAndShowResult(stmt, dqColNames[n], 5 + n);
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
75 }
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
76 // query all columns
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
77 executeQueryAndShowResult(stmt, "*", 5 + dqColNames.length);
104
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
78
119
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
79 System.out.println("Finally drop table " + dqTblName);
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
80 ret = stmt.executeUpdate("DROP TABLE " + dqTblName);
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
81 System.out.println(" returned: " + ret + " (expected -2)");
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
82 System.out.println();
104
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
83 } catch (SQLException se) {
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
84 System.out.println("Failure occurred: " + se);
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
85 } finally {
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
86 if (rs != null)
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
87 rs.close();
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
88 stmt.close();
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
89 }
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
90 con.close();
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
91 }
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
92
119
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
93 private static void executeQueryAndShowResult(Statement st, String col_list, int query_count) throws SQLException {
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
94 System.out.print(query_count);
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
95 System.out.println(". show content of column(s): " + col_list);
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
96 ResultSet rs = st.executeQuery("SELECT " + col_list + " from " + dqTblName);
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
97 showResultAndClose(rs);
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
98 }
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
99
104
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
100 private static void showResultAndClose(ResultSet rs) throws SQLException {
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
101 ResultSetMetaData rsmd = rs.getMetaData();
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
102 int rs_col_count = rsmd.getColumnCount();
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
103 System.out.println("Resultset with " + rs_col_count + " columns");
119
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
104 System.out.println("\tColumn Name, Column Label:");
104
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
105 for (int col = 1; col <= rs_col_count; col++) {
119
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
106 System.out.println(col + "\t" + rsmd.getColumnName(col) + "\t" +rsmd.getColumnLabel(col));
104
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
107 }
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
108
119
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
109 System.out.println("Data rows:");
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
110 long row_count = 0;
104
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
111 while (rs.next()) {
119
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
112 row_count++;
104
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
113 for (int col = 1; col <= rs_col_count; col++) {
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
114 if (col > 1)
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
115 System.out.print("\t");
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
116 System.out.print(rs.getString(col));
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
117 }
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
118 System.out.println();
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
119 }
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
120 rs.close();
119
1ea2ee3b946c Extend HeaderLineParser to also correctly parse result set header lines for table
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 104
diff changeset
121 System.out.println("Listed " + row_count + " rows");
104
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
122 System.out.println();
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
123 }
839ffec1d36d Fix for bug 6183.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents:
diff changeset
124 }