JDBC driver class can be specified in the database configuration as an optional parameter (useful especially while embedding jdbc-dk-driver into other application that does not support automatic driver discovery)
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.sql.dk.formatting;
20 import info.globalcode.sql.dk.SQLType;
21 import java.sql.Array;
22 import java.sql.ResultSet;
23 import java.sql.SQLException;
27 * Fake SQL array, for formatting purposes only
29 * @author Ing. František Kučera (frantovo.cz)
31 public class FakeSqlArray implements Array {
33 private static final UnsupportedOperationException exception = new UnsupportedOperationException("This is just a fake SQL array.");
34 private final Object[] data;
35 private final SQLType baseType;
37 public FakeSqlArray(Object[] data, SQLType baseType) {
39 this.baseType = baseType;
43 public String toString() {
44 StringBuilder string = new StringBuilder();
45 for (Object o : data) {
49 return string.toString();
53 public String getBaseTypeName() throws SQLException {
54 return baseType.name();
58 public int getBaseType() throws SQLException {
59 return baseType.getCode();
63 public Object getArray() throws SQLException {
68 public Object getArray(Map<String, Class<?>> map) throws SQLException {
73 public Object getArray(long index, int count) throws SQLException {
78 public Object getArray(long index, int count, Map<String, Class<?>> map) throws SQLException {
83 public ResultSet getResultSet() throws SQLException {
88 public ResultSet getResultSet(Map<String, Class<?>> map) throws SQLException {
93 public ResultSet getResultSet(long index, int count) throws SQLException {
98 public ResultSet getResultSet(long index, int count, Map<String, Class<?>> map) throws SQLException {
103 public void free() throws SQLException {