# HG changeset patch # User František Kučera # Date 1396647628 -7200 # Node ID 701ec4db43fbf6e523f8181597213a97901fa658 # Parent 8f142472270c8fcbdf19093b6c0b89f2431477d3 JDBC loopback driver: first version experimental JDBC driver which does not need any real SQL database, just passes values of statement parameters as a result set. The first parameter is column count, then follows column names and then data. Example: 2 a b c d e f will result into table: a | b ----- c | d e | f diff -r 8f142472270c -r 701ec4db43fb java/jdbc-loopback-driver/build.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/jdbc-loopback-driver/build.xml Fri Apr 04 23:40:28 2014 +0200 @@ -0,0 +1,73 @@ + + + + + + + + + + + Builds, tests, and runs the project jdbc-loopback-driver. + + + diff -r 8f142472270c -r 701ec4db43fb java/jdbc-loopback-driver/conf/META-INF/services/java.sql.Driver --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/jdbc-loopback-driver/conf/META-INF/services/java.sql.Driver Fri Apr 04 23:40:28 2014 +0200 @@ -0,0 +1,1 @@ +info.globalcode.jdbc.loopback.Driver diff -r 8f142472270c -r 701ec4db43fb java/jdbc-loopback-driver/nbproject/build-impl.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/jdbc-loopback-driver/nbproject/build-impl.xml Fri Apr 04 23:40:28 2014 +0200 @@ -0,0 +1,1422 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.conf.dir + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 8f142472270c -r 701ec4db43fb java/jdbc-loopback-driver/nbproject/genfiles.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/jdbc-loopback-driver/nbproject/genfiles.properties Fri Apr 04 23:40:28 2014 +0200 @@ -0,0 +1,8 @@ +build.xml.data.CRC32=09144cff +build.xml.script.CRC32=58587e87 +build.xml.stylesheet.CRC32=8064a381@1.74.1.48 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=09144cff +nbproject/build-impl.xml.script.CRC32=1af5d34f +nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.74.1.48 diff -r 8f142472270c -r 701ec4db43fb java/jdbc-loopback-driver/nbproject/project.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/jdbc-loopback-driver/nbproject/project.properties Fri Apr 04 23:40:28 2014 +0200 @@ -0,0 +1,74 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +application.title=jdbc-loopback-driver +application.vendor=fiki +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# Files in build.classes.dir which should be excluded from distribution jar +dist.archive.excludes= +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/jdbc-loopback-driver.jar +dist.javadoc.dir=${dist.dir}/javadoc +endorsed.classpath= +excludes= +includes=** +jar.compress=false +javac.classpath= +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.processorpath=\ + ${javac.classpath} +javac.source=1.7 +javac.target=1.7 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=true +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project. +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. +# To set system properties for unit tests define test-sys-prop.name=value: +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +src.conf.dir=conf +src.dir=src +test.src.dir=test diff -r 8f142472270c -r 701ec4db43fb java/jdbc-loopback-driver/nbproject/project.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/jdbc-loopback-driver/nbproject/project.xml Fri Apr 04 23:40:28 2014 +0200 @@ -0,0 +1,16 @@ + + + org.netbeans.modules.java.j2seproject + + + jdbc-loopback-driver + + + + + + + + + + diff -r 8f142472270c -r 701ec4db43fb java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/AbstractConnection.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/AbstractConnection.java Fri Apr 04 23:40:28 2014 +0200 @@ -0,0 +1,311 @@ +/** + * SQL-DK + * Copyright © 2014 František Kučera (frantovo.cz) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package info.globalcode.jdbc.loopback; + +import java.sql.Array; +import java.sql.Blob; +import java.sql.CallableStatement; +import java.sql.Clob; +import java.sql.DatabaseMetaData; +import java.sql.NClob; +import java.sql.SQLClientInfoException; +import java.sql.SQLException; +import java.sql.SQLWarning; +import java.sql.SQLXML; +import java.sql.Savepoint; +import java.sql.Struct; +import java.util.Map; +import java.util.Properties; +import java.util.concurrent.Executor; + +/** + * + * @author Ing. František Kučera (frantovo.cz) + */ +public abstract class AbstractConnection implements java.sql.Connection { + + @Override + public java.sql.Statement createStatement() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public java.sql.PreparedStatement prepareStatement(String sql) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public CallableStatement prepareCall(String sql) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public String nativeSQL(String sql) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setAutoCommit(boolean autoCommit) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean getAutoCommit() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void commit() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void rollback() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void close() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean isClosed() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public DatabaseMetaData getMetaData() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setReadOnly(boolean readOnly) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean isReadOnly() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setCatalog(String catalog) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public String getCatalog() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setTransactionIsolation(int level) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int getTransactionIsolation() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public SQLWarning getWarnings() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void clearWarnings() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Map> getTypeMap() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setTypeMap(Map> map) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setHoldability(int holdability) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int getHoldability() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Savepoint setSavepoint() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Savepoint setSavepoint(String name) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void rollback(Savepoint savepoint) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void releaseSavepoint(Savepoint savepoint) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Clob createClob() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Blob createBlob() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public NClob createNClob() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public SQLXML createSQLXML() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean isValid(int timeout) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setClientInfo(String name, String value) throws SQLClientInfoException { + throw new SQLClientInfoException("Not supported yet.", null); + } + + @Override + public void setClientInfo(Properties properties) throws SQLClientInfoException { + throw new SQLClientInfoException("Not supported yet.", null); + } + + @Override + public String getClientInfo(String name) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Properties getClientInfo() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Array createArrayOf(String typeName, Object[] elements) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Struct createStruct(String typeName, Object[] attributes) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setSchema(String schema) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public String getSchema() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void abort(Executor executor) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int getNetworkTimeout() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public T unwrap(Class iface) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean isWrapperFor(Class iface) throws SQLException { + throw new SQLException("Not supported yet."); + } +} diff -r 8f142472270c -r 701ec4db43fb java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/AbstractPreparedStatement.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/AbstractPreparedStatement.java Fri Apr 04 23:40:28 2014 +0200 @@ -0,0 +1,322 @@ +/** + * SQL-DK + * Copyright © 2014 František Kučera (frantovo.cz) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package info.globalcode.jdbc.loopback; + +import java.io.InputStream; +import java.io.Reader; +import java.math.BigDecimal; +import java.net.URL; +import java.sql.Array; +import java.sql.Blob; +import java.sql.Clob; +import java.sql.Date; +import java.sql.NClob; +import java.sql.ParameterMetaData; +import java.sql.Ref; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.RowId; +import java.sql.SQLException; +import java.sql.SQLXML; +import java.sql.Time; +import java.sql.Timestamp; +import java.util.Calendar; + +/** + * + * @author Ing. František Kučera (frantovo.cz) + */ +public abstract class AbstractPreparedStatement extends AbstractStatement implements java.sql.PreparedStatement { + + @Override + public ResultSet executeQuery() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int executeUpdate() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setNull(int parameterIndex, int sqlType) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setBoolean(int parameterIndex, boolean x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setByte(int parameterIndex, byte x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setShort(int parameterIndex, short x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setInt(int parameterIndex, int x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setLong(int parameterIndex, long x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setFloat(int parameterIndex, float x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setDouble(int parameterIndex, double x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setString(int parameterIndex, String x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setBytes(int parameterIndex, byte[] x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setDate(int parameterIndex, Date x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setTime(int parameterIndex, Time x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + @Deprecated + public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void clearParameters() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setObject(int parameterIndex, Object x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean execute() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void addBatch() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setRef(int parameterIndex, Ref x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setBlob(int parameterIndex, Blob x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setClob(int parameterIndex, Clob x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setArray(int parameterIndex, Array x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public ResultSetMetaData getMetaData() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setURL(int parameterIndex, URL x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public ParameterMetaData getParameterMetaData() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setRowId(int parameterIndex, RowId x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setNString(int parameterIndex, String value) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setNClob(int parameterIndex, NClob value) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setClob(int parameterIndex, Reader reader, long length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setClob(int parameterIndex, Reader reader) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setNClob(int parameterIndex, Reader reader) throws SQLException { + throw new SQLException("Not supported yet."); + } + +} diff -r 8f142472270c -r 701ec4db43fb java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/AbstractResultSet.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/AbstractResultSet.java Fri Apr 04 23:40:28 2014 +0200 @@ -0,0 +1,1000 @@ +/** + * SQL-DK + * Copyright © 2014 František Kučera (frantovo.cz) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package info.globalcode.jdbc.loopback; + +import java.io.InputStream; +import java.io.Reader; +import java.math.BigDecimal; +import java.net.URL; +import java.sql.Array; +import java.sql.Blob; +import java.sql.Clob; +import java.sql.Date; +import java.sql.NClob; +import java.sql.Ref; +import java.sql.RowId; +import java.sql.SQLException; +import java.sql.SQLWarning; +import java.sql.SQLXML; +import java.sql.Statement; +import java.sql.Time; +import java.sql.Timestamp; +import java.util.Calendar; +import java.util.Map; + +/** + * + * @author Ing. František Kučera (frantovo.cz) + */ +public abstract class AbstractResultSet implements java.sql.ResultSet { + + @Override + public boolean next() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void close() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean wasNull() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public String getString(int columnIndex) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean getBoolean(int columnIndex) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public byte getByte(int columnIndex) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public short getShort(int columnIndex) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int getInt(int columnIndex) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public long getLong(int columnIndex) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public float getFloat(int columnIndex) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public double getDouble(int columnIndex) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public byte[] getBytes(int columnIndex) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Date getDate(int columnIndex) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Time getTime(int columnIndex) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(int columnIndex) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public InputStream getAsciiStream(int columnIndex) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public InputStream getUnicodeStream(int columnIndex) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public InputStream getBinaryStream(int columnIndex) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public String getString(String columnLabel) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean getBoolean(String columnLabel) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public byte getByte(String columnLabel) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public short getShort(String columnLabel) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int getInt(String columnLabel) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public long getLong(String columnLabel) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public float getFloat(String columnLabel) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public double getDouble(String columnLabel) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public byte[] getBytes(String columnLabel) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Date getDate(String columnLabel) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Time getTime(String columnLabel) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(String columnLabel) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public InputStream getAsciiStream(String columnLabel) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public InputStream getUnicodeStream(String columnLabel) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public InputStream getBinaryStream(String columnLabel) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public SQLWarning getWarnings() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void clearWarnings() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public String getCursorName() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public java.sql.ResultSetMetaData getMetaData() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Object getObject(int columnIndex) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Object getObject(String columnLabel) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int findColumn(String columnLabel) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Reader getCharacterStream(int columnIndex) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Reader getCharacterStream(String columnLabel) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(int columnIndex) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public BigDecimal getBigDecimal(String columnLabel) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean isBeforeFirst() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean isAfterLast() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean isFirst() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean isLast() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void beforeFirst() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void afterLast() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean first() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean last() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int getRow() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean absolute(int row) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean relative(int rows) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean previous() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setFetchDirection(int direction) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int getFetchDirection() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setFetchSize(int rows) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int getFetchSize() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int getType() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int getConcurrency() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean rowUpdated() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean rowInserted() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean rowDeleted() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateNull(int columnIndex) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateBoolean(int columnIndex, boolean x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateByte(int columnIndex, byte x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateShort(int columnIndex, short x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateInt(int columnIndex, int x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateLong(int columnIndex, long x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateFloat(int columnIndex, float x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateDouble(int columnIndex, double x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateString(int columnIndex, String x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateBytes(int columnIndex, byte[] x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateDate(int columnIndex, Date x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateTime(int columnIndex, Time x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateObject(int columnIndex, Object x, int scaleOrLength) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateObject(int columnIndex, Object x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateNull(String columnLabel) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateBoolean(String columnLabel, boolean x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateByte(String columnLabel, byte x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateShort(String columnLabel, short x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateInt(String columnLabel, int x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateLong(String columnLabel, long x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateFloat(String columnLabel, float x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateDouble(String columnLabel, double x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateString(String columnLabel, String x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateBytes(String columnLabel, byte[] x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateDate(String columnLabel, Date x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateTime(String columnLabel, Time x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateTimestamp(String columnLabel, Timestamp x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateBinaryStream(String columnLabel, InputStream x, int length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateCharacterStream(String columnLabel, Reader reader, int length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateObject(String columnLabel, Object x, int scaleOrLength) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateObject(String columnLabel, Object x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void insertRow() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateRow() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void deleteRow() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void refreshRow() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void cancelRowUpdates() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void moveToInsertRow() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void moveToCurrentRow() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Statement getStatement() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Object getObject(int columnIndex, Map> map) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Ref getRef(int columnIndex) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Blob getBlob(int columnIndex) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Clob getClob(int columnIndex) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Array getArray(int columnIndex) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Object getObject(String columnLabel, Map> map) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Ref getRef(String columnLabel) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Blob getBlob(String columnLabel) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Clob getClob(String columnLabel) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Array getArray(String columnLabel) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Date getDate(int columnIndex, Calendar cal) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Date getDate(String columnLabel, Calendar cal) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Time getTime(int columnIndex, Calendar cal) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Time getTime(String columnLabel, Calendar cal) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Timestamp getTimestamp(String columnLabel, Calendar cal) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public URL getURL(int columnIndex) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public URL getURL(String columnLabel) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateRef(int columnIndex, Ref x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateRef(String columnLabel, Ref x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateBlob(int columnIndex, Blob x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateBlob(String columnLabel, Blob x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateClob(int columnIndex, Clob x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateClob(String columnLabel, Clob x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateArray(int columnIndex, Array x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateArray(String columnLabel, Array x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public RowId getRowId(int columnIndex) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public RowId getRowId(String columnLabel) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateRowId(int columnIndex, RowId x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateRowId(String columnLabel, RowId x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int getHoldability() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean isClosed() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateNString(int columnIndex, String nString) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateNString(String columnLabel, String nString) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateNClob(int columnIndex, NClob nClob) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateNClob(String columnLabel, NClob nClob) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public NClob getNClob(int columnIndex) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public NClob getNClob(String columnLabel) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public SQLXML getSQLXML(int columnIndex) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public SQLXML getSQLXML(String columnLabel) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public String getNString(int columnIndex) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public String getNString(String columnLabel) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Reader getNCharacterStream(int columnIndex) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Reader getNCharacterStream(String columnLabel) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateClob(int columnIndex, Reader reader, long length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateClob(String columnLabel, Reader reader, long length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateCharacterStream(int columnIndex, Reader x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateClob(int columnIndex, Reader reader) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateClob(String columnLabel, Reader reader) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateNClob(int columnIndex, Reader reader) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void updateNClob(String columnLabel, Reader reader) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public T getObject(int columnIndex, Class type) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public T getObject(String columnLabel, Class type) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public T unwrap(Class iface) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean isWrapperFor(Class iface) throws SQLException { + throw new SQLException("Not supported yet."); + } +} diff -r 8f142472270c -r 701ec4db43fb java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/AbstractResultSetMetaData.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/AbstractResultSetMetaData.java Fri Apr 04 23:40:28 2014 +0200 @@ -0,0 +1,142 @@ +/** + * SQL-DK + * Copyright © 2014 František Kučera (frantovo.cz) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package info.globalcode.jdbc.loopback; + +import java.sql.SQLException; + +/** + * + * @author Ing. František Kučera (frantovo.cz) + */ +public abstract class AbstractResultSetMetaData implements java.sql.ResultSetMetaData { + + @Override + public int getColumnCount() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean isAutoIncrement(int column) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean isCaseSensitive(int column) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean isSearchable(int column) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean isCurrency(int column) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int isNullable(int column) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean isSigned(int column) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int getColumnDisplaySize(int column) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public String getColumnLabel(int column) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public String getColumnName(int column) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public String getSchemaName(int column) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int getPrecision(int column) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int getScale(int column) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public String getTableName(int column) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public String getCatalogName(int column) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int getColumnType(int column) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public String getColumnTypeName(int column) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean isReadOnly(int column) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean isWritable(int column) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean isDefinitelyWritable(int column) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public String getColumnClassName(int column) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public T unwrap(Class iface) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean isWrapperFor(Class iface) throws SQLException { + throw new SQLException("Not supported yet."); + } +} diff -r 8f142472270c -r 701ec4db43fb java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/AbstractStatement.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/AbstractStatement.java Fri Apr 04 23:40:28 2014 +0200 @@ -0,0 +1,250 @@ +/** + * SQL-DK + * Copyright © 2014 František Kučera (frantovo.cz) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package info.globalcode.jdbc.loopback; + +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.SQLWarning; + +/** + * + * @author Ing. František Kučera (frantovo.cz) + */ +public abstract class AbstractStatement implements java.sql.Statement { + + @Override + public ResultSet executeQuery(String sql) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int executeUpdate(String sql) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void close() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int getMaxFieldSize() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setMaxFieldSize(int max) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int getMaxRows() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setMaxRows(int max) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setEscapeProcessing(boolean enable) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int getQueryTimeout() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setQueryTimeout(int seconds) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void cancel() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public SQLWarning getWarnings() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void clearWarnings() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setCursorName(String name) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean execute(String sql) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public java.sql.ResultSet getResultSet() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int getUpdateCount() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean getMoreResults() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setFetchDirection(int direction) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int getFetchDirection() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setFetchSize(int rows) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int getFetchSize() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int getResultSetConcurrency() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int getResultSetType() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void addBatch(String sql) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void clearBatch() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int[] executeBatch() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public Connection getConnection() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean getMoreResults(int current) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public ResultSet getGeneratedKeys() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int executeUpdate(String sql, int[] columnIndexes) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int executeUpdate(String sql, String[] columnNames) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean execute(String sql, int autoGeneratedKeys) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean execute(String sql, int[] columnIndexes) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean execute(String sql, String[] columnNames) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public int getResultSetHoldability() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean isClosed() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void setPoolable(boolean poolable) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean isPoolable() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public void closeOnCompletion() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean isCloseOnCompletion() throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public T unwrap(Class iface) throws SQLException { + throw new SQLException("Not supported yet."); + } + + @Override + public boolean isWrapperFor(Class iface) throws SQLException { + throw new SQLException("Not supported yet."); + } + +} diff -r 8f142472270c -r 701ec4db43fb java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/Connection.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/Connection.java Fri Apr 04 23:40:28 2014 +0200 @@ -0,0 +1,135 @@ +/** + * SQL-DK + * Copyright © 2014 František Kučera (frantovo.cz) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package info.globalcode.jdbc.loopback; + +import java.sql.SQLClientInfoException; +import java.sql.SQLException; +import java.sql.SQLWarning; +import java.sql.Savepoint; +import java.util.Map; +import java.util.Properties; +import java.util.concurrent.Executor; + +/** + * + * @author Ing. František Kučera (frantovo.cz) + */ +public class Connection extends AbstractConnection { + + private String url; + private Properties info; + + public Connection(String url, Properties info) { + this.url = url; + this.info = info; + } + + @Override + public java.sql.PreparedStatement prepareStatement(String sql) throws SQLException { + return new PreparedStatement(); + } + + @Override + public void setAutoCommit(boolean autoCommit) throws SQLException { + } + + @Override + public boolean getAutoCommit() throws SQLException { + return true; + } + + @Override + public void commit() throws SQLException { + } + + @Override + public void rollback() throws SQLException { + } + + @Override + public void close() throws SQLException { + } + + @Override + public boolean isClosed() throws SQLException { + return false; + } + + @Override + public void setReadOnly(boolean readOnly) throws SQLException { + } + + @Override + public boolean isReadOnly() throws SQLException { + return true; + } + + @Override + public void setCatalog(String catalog) throws SQLException { + } + + @Override + public void setTransactionIsolation(int level) throws SQLException { + } + + @Override + public SQLWarning getWarnings() throws SQLException { + return null; + } + + @Override + public void clearWarnings() throws SQLException { + } + + @Override + public void setTypeMap(Map> map) throws SQLException { + } + + @Override + public void setHoldability(int holdability) throws SQLException { + } + + @Override + public void rollback(Savepoint savepoint) throws SQLException { + } + + @Override + public void releaseSavepoint(Savepoint savepoint) throws SQLException { + } + + @Override + public boolean isValid(int timeout) throws SQLException { + return true; + } + + @Override + public void setClientInfo(String name, String value) throws SQLClientInfoException { + } + + @Override + public void setClientInfo(Properties properties) throws SQLClientInfoException { + } + + @Override + public void abort(Executor executor) throws SQLException { + } + + @Override + public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException { + } +} diff -r 8f142472270c -r 701ec4db43fb java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/Driver.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/Driver.java Fri Apr 04 23:40:28 2014 +0200 @@ -0,0 +1,79 @@ +/** + * SQL-DK + * Copyright © 2014 František Kučera (frantovo.cz) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package info.globalcode.jdbc.loopback; + +import java.sql.DriverManager; +import java.sql.DriverPropertyInfo; +import java.sql.SQLException; +import java.sql.SQLFeatureNotSupportedException; +import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * + * @author Ing. František Kučera (frantovo.cz) + */ +public class Driver implements java.sql.Driver { + + private static final Logger log = Logger.getLogger(Driver.class.getName()); + + static { + try { + DriverManager.registerDriver(new Driver()); + } catch (SQLException e) { + log.log(Level.SEVERE, "Unable to register JDBC driver", e); + } + } + + @Override + public Connection connect(String url, Properties info) throws SQLException { + return new Connection(url, info); + } + + @Override + public boolean acceptsURL(String url) throws SQLException { + return url != null && url.startsWith("jdbc:loopback://"); + } + + @Override + public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException { + return new DriverPropertyInfo[0]; + } + + @Override + public int getMajorVersion() { + return 0; + } + + @Override + public int getMinorVersion() { + return 1; + } + + @Override + public boolean jdbcCompliant() { + return false; + } + + @Override + public Logger getParentLogger() throws SQLFeatureNotSupportedException { + throw new SQLFeatureNotSupportedException("Not supported yet."); + } + +} diff -r 8f142472270c -r 701ec4db43fb java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/ObjectParameter.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/ObjectParameter.java Fri Apr 04 23:40:28 2014 +0200 @@ -0,0 +1,41 @@ +/** + * SQL-DK + * Copyright © 2014 František Kučera (frantovo.cz) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package info.globalcode.jdbc.loopback; + +/** + * + * @author Ing. František Kučera (frantovo.cz) + */ +public class ObjectParameter { + + private final Object data; + private final int targetSqlType; + + public ObjectParameter(Object data, int targetSqlType) { + this.data = data; + this.targetSqlType = targetSqlType; + } + + public Object getData() { + return data; + } + + public int getTargetSqlType() { + return targetSqlType; + } +} diff -r 8f142472270c -r 701ec4db43fb java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/PreparedStatement.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/PreparedStatement.java Fri Apr 04 23:40:28 2014 +0200 @@ -0,0 +1,107 @@ +/** + * SQL-DK + * Copyright © 2014 František Kučera (frantovo.cz) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package info.globalcode.jdbc.loopback; + +import java.sql.SQLException; +import java.sql.SQLWarning; +import java.sql.Types; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * + * @author Ing. František Kučera (frantovo.cz) + */ +public class PreparedStatement extends AbstractPreparedStatement { + + private Map parameters = new HashMap<>(); + private List table; + private ResultSetMetaData metadata = new ResultSetMetaData(); + + @Override + public void setObject(int parameterIndex, Object data, int targetSqlType) throws SQLException { + parameters.put(parameterIndex, new ObjectParameter(data, targetSqlType)); + } + + @Override + public boolean execute() throws SQLException { + + if (parameters.size() < 1) { + throw new SQLException("Missing first parameter (column count)"); + } else { + int columnCount = Integer.valueOf((String) parameters.get(1).getData()); + + for (int i = 0; i < columnCount; i++) { + String label = parameters.get(1 + i + 1).getData().toString(); + metadata.addColumn(new ResultSetMetaData.ColumnDescriptor(Types.VARCHAR, "VARCHAR", label, label)); + } + + int cellIndex = 0; + + table = new ArrayList<>(); + Object[] currentRow = null; + + for (int parameterNumber = (1 + columnCount + 1); true; parameterNumber++) { + ObjectParameter data = parameters.get(parameterNumber); + if (data == null) { + break; + } else { + int columnIndex = cellIndex % columnCount; + cellIndex++; + if (columnIndex == 0) { + currentRow = new Object[columnCount]; + table.add(currentRow); + } + currentRow[columnIndex] = data.getData(); + } + } + + return true; + } + } + + @Override + public java.sql.ResultSet getResultSet() throws SQLException { + return new ResultSet(metadata, table); + } + + @Override + public int getUpdateCount() throws SQLException { + return -1; + } + + @Override + public boolean getMoreResults() throws SQLException { + return false; + } + + @Override + public void close() throws SQLException { + } + + @Override + public SQLWarning getWarnings() throws SQLException { + return null; + } + + @Override + public void clearWarnings() throws SQLException { + } +} diff -r 8f142472270c -r 701ec4db43fb java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/ResultSet.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/ResultSet.java Fri Apr 04 23:40:28 2014 +0200 @@ -0,0 +1,67 @@ +/** + * SQL-DK + * Copyright © 2014 František Kučera (frantovo.cz) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package info.globalcode.jdbc.loopback; + +import java.sql.SQLException; +import java.util.Iterator; +import java.util.List; + +/** + * + * @author Ing. František Kučera (frantovo.cz) + */ +public class ResultSet extends AbstractResultSet { + + private final ResultSetMetaData metadata; + private final Iterator data; + private Object[] currentRow; + + public ResultSet(ResultSetMetaData metadata, List table) { + data = table.listIterator(); + this.metadata = metadata; + } + + @Override + public boolean next() throws SQLException { + if (data.hasNext()) { + currentRow = data.next(); + return true; + } else { + return false; + } + } + + @Override + public Object getObject(int columnNumber) throws SQLException { + return currentRow[columnNumber - 1]; + } + + @Override + public ResultSetMetaData getMetaData() throws SQLException { + return metadata; + } + + @Override + public void close() throws SQLException { + } + + @Override + public boolean isClosed() throws SQLException { + return false; + } +} diff -r 8f142472270c -r 701ec4db43fb java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/ResultSetMetaData.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/ResultSetMetaData.java Fri Apr 04 23:40:28 2014 +0200 @@ -0,0 +1,75 @@ +/** + * SQL-DK + * Copyright © 2014 František Kučera (frantovo.cz) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package info.globalcode.jdbc.loopback; + +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +/** + * + * @author Ing. František Kučera (frantovo.cz) + */ +public class ResultSetMetaData extends AbstractResultSetMetaData { + + private List columns = new ArrayList<>(); + + public void addColumn(ColumnDescriptor cd) { + columns.add(cd); + } + + @Override + public int getColumnCount() throws SQLException { + return columns.size(); + } + + @Override + public String getColumnLabel(int column) throws SQLException { + return columns.get(column - 1).label; + } + + @Override + public String getColumnName(int column) throws SQLException { + return columns.get(column - 1).name; + } + + @Override + public int getColumnType(int column) throws SQLException { + return columns.get(column - 1).type; + } + + @Override + public String getColumnTypeName(int column) throws SQLException { + return columns.get(column - 1).typeName; + } + + public static class ColumnDescriptor { + + private final int type; + private final String typeName; + private final String label; + private final String name; + + public ColumnDescriptor(int type, String typeName, String label, String name) { + this.type = type; + this.typeName = typeName; + this.label = label; + this.name = name; + } + } +}