java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/ResultSetMetaData.java
parallel connection testing: avoid deadlocks – preload drivers + better exception handling and logging
3 * Copyright © 2014 František Kučera (frantovo.cz)
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package info.globalcode.jdbc.loopback;
20 import java.sql.SQLException;
21 import java.util.ArrayList;
22 import java.util.List;
26 * @author Ing. František Kučera (frantovo.cz)
28 public class ResultSetMetaData extends AbstractResultSetMetaData {
30 private List<ColumnDescriptor> columns = new ArrayList<>();
32 public void addColumn(ColumnDescriptor cd) {
37 public int getColumnCount() throws SQLException {
38 return columns.size();
42 public String getColumnLabel(int column) throws SQLException {
43 return columns.get(column - 1).label;
47 public String getColumnName(int column) throws SQLException {
48 return columns.get(column - 1).name;
52 public int getColumnType(int column) throws SQLException {
53 return columns.get(column - 1).type;
57 public String getColumnTypeName(int column) throws SQLException {
58 return columns.get(column - 1).typeName;
61 public static class ColumnDescriptor {
63 private final int type;
64 private final String typeName;
65 private final String label;
66 private final String name;
68 public ColumnDescriptor(int type, String typeName, String label, String name) {
70 this.typeName = typeName;