java/sql-dk/src/main/java/info/globalcode/sql/dk/formatting/FakeSqlArray.java
author František Kučera <franta-hg@frantovo.cz>
Thu, 24 Oct 2019 21:43:08 +0200
branchv_0
changeset 250 aae5009bd0af
parent 238 4a1864c3e867
permissions -rw-r--r--
fix license version: GNU GPLv3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
159
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
/**
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
 * SQL-DK
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
 * Copyright © 2014 František Kučera (frantovo.cz)
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
 *
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
 * This program is free software: you can redistribute it and/or modify
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
250
aae5009bd0af fix license version: GNU GPLv3
František Kučera <franta-hg@frantovo.cz>
parents: 238
diff changeset
     7
 * the Free Software Foundation, version 3 of the License.
159
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
 *
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
 * GNU General Public License for more details.
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
 *
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
 */
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
package info.globalcode.sql.dk.formatting;
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
import info.globalcode.sql.dk.SQLType;
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
import java.sql.Array;
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
import java.sql.ResultSet;
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    22
import java.sql.SQLException;
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
import java.util.Map;
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    25
/**
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    26
 * Fake SQL array, for formatting purposes only
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    27
 *
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    28
 * @author Ing. František Kučera (frantovo.cz)
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    29
 */
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    30
public class FakeSqlArray implements Array {
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    31
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    32
	private static final UnsupportedOperationException exception = new UnsupportedOperationException("This is just a fake SQL array.");
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    33
	private final Object[] data;
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    34
	private final SQLType baseType;
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    35
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    36
	public FakeSqlArray(Object[] data, SQLType baseType) {
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    37
		this.data = data;
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    38
		this.baseType = baseType;
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    39
	}
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    40
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    41
	@Override
164
8cc7862605a1 FakeSqlArray#toString()
František Kučera <franta-hg@frantovo.cz>
parents: 159
diff changeset
    42
	public String toString() {
8cc7862605a1 FakeSqlArray#toString()
František Kučera <franta-hg@frantovo.cz>
parents: 159
diff changeset
    43
		StringBuilder string = new StringBuilder();
8cc7862605a1 FakeSqlArray#toString()
František Kučera <franta-hg@frantovo.cz>
parents: 159
diff changeset
    44
		for (Object o : data) {
8cc7862605a1 FakeSqlArray#toString()
František Kučera <franta-hg@frantovo.cz>
parents: 159
diff changeset
    45
			string.append(o);
8cc7862605a1 FakeSqlArray#toString()
František Kučera <franta-hg@frantovo.cz>
parents: 159
diff changeset
    46
			string.append("\n");
8cc7862605a1 FakeSqlArray#toString()
František Kučera <franta-hg@frantovo.cz>
parents: 159
diff changeset
    47
		}
8cc7862605a1 FakeSqlArray#toString()
František Kučera <franta-hg@frantovo.cz>
parents: 159
diff changeset
    48
		return string.toString();
8cc7862605a1 FakeSqlArray#toString()
František Kučera <franta-hg@frantovo.cz>
parents: 159
diff changeset
    49
	}
8cc7862605a1 FakeSqlArray#toString()
František Kučera <franta-hg@frantovo.cz>
parents: 159
diff changeset
    50
8cc7862605a1 FakeSqlArray#toString()
František Kučera <franta-hg@frantovo.cz>
parents: 159
diff changeset
    51
	@Override
159
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    52
	public String getBaseTypeName() throws SQLException {
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    53
		return baseType.name();
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    54
	}
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    55
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    56
	@Override
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    57
	public int getBaseType() throws SQLException {
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    58
		return baseType.getCode();
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    59
	}
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    60
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    61
	@Override
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    62
	public Object getArray() throws SQLException {
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    63
		return data;
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    64
	}
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    65
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    66
	@Override
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    67
	public Object getArray(Map<String, Class<?>> map) throws SQLException {
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    68
		throw exception;
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    69
	}
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    70
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    71
	@Override
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    72
	public Object getArray(long index, int count) throws SQLException {
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    73
		throw exception;
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    74
	}
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    75
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    76
	@Override
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    77
	public Object getArray(long index, int count, Map<String, Class<?>> map) throws SQLException {
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    78
		throw exception;
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    79
	}
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    80
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    81
	@Override
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    82
	public ResultSet getResultSet() throws SQLException {
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    83
		throw exception;
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    84
	}
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    85
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    86
	@Override
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    87
	public ResultSet getResultSet(Map<String, Class<?>> map) throws SQLException {
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    88
		throw exception;
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    89
	}
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    90
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    91
	@Override
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    92
	public ResultSet getResultSet(long index, int count) throws SQLException {
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    93
		throw exception;
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    94
	}
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    95
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    96
	@Override
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    97
	public ResultSet getResultSet(long index, int count, Map<String, Class<?>> map) throws SQLException {
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    98
		throw exception;
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    99
	}
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   100
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   101
	@Override
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   102
	public void free() throws SQLException {
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   103
		throw exception;
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   104
	}
9632b23df30c InfoLister: list configured and configurable JDBC driver properties – option: --list-jdbc-properties
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   105
}