java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/AbstractConnection.java
author František Kučera <franta-hg@frantovo.cz>
Fri, 04 Apr 2014 23:40:28 +0200
branchv_0
changeset 171 701ec4db43fb
permissions -rw-r--r--
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
     1 /**
     2  * SQL-DK
     3  * Copyright © 2014 František Kučera (frantovo.cz)
     4  *
     5  * This program is free software: you can redistribute it and/or modify
     6  * it under the terms of the GNU General Public License as published by
     7  * the Free Software Foundation, either version 3 of the License, or
     8  * (at your option) any later version.
     9  *
    10  * This program is distributed in the hope that it will be useful,
    11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    13  * GNU General Public License for more details.
    14  *
    15  * You should have received a copy of the GNU General Public License
    16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
    17  */
    18 package info.globalcode.jdbc.loopback;
    19 
    20 import java.sql.Array;
    21 import java.sql.Blob;
    22 import java.sql.CallableStatement;
    23 import java.sql.Clob;
    24 import java.sql.DatabaseMetaData;
    25 import java.sql.NClob;
    26 import java.sql.SQLClientInfoException;
    27 import java.sql.SQLException;
    28 import java.sql.SQLWarning;
    29 import java.sql.SQLXML;
    30 import java.sql.Savepoint;
    31 import java.sql.Struct;
    32 import java.util.Map;
    33 import java.util.Properties;
    34 import java.util.concurrent.Executor;
    35 
    36 /**
    37  *
    38  * @author Ing. František Kučera (frantovo.cz)
    39  */
    40 public abstract class AbstractConnection implements java.sql.Connection {
    41 
    42 	@Override
    43 	public java.sql.Statement createStatement() throws SQLException {
    44 		throw new SQLException("Not supported yet.");
    45 	}
    46 
    47 	@Override
    48 	public java.sql.PreparedStatement prepareStatement(String sql) throws SQLException {
    49 		throw new SQLException("Not supported yet.");
    50 	}
    51 
    52 	@Override
    53 	public CallableStatement prepareCall(String sql) throws SQLException {
    54 		throw new SQLException("Not supported yet.");
    55 	}
    56 
    57 	@Override
    58 	public String nativeSQL(String sql) throws SQLException {
    59 		throw new SQLException("Not supported yet.");
    60 	}
    61 
    62 	@Override
    63 	public void setAutoCommit(boolean autoCommit) throws SQLException {
    64 		throw new SQLException("Not supported yet.");
    65 	}
    66 
    67 	@Override
    68 	public boolean getAutoCommit() throws SQLException {
    69 		throw new SQLException("Not supported yet.");
    70 	}
    71 
    72 	@Override
    73 	public void commit() throws SQLException {
    74 		throw new SQLException("Not supported yet.");
    75 	}
    76 
    77 	@Override
    78 	public void rollback() throws SQLException {
    79 		throw new SQLException("Not supported yet.");
    80 	}
    81 
    82 	@Override
    83 	public void close() throws SQLException {
    84 		throw new SQLException("Not supported yet.");
    85 	}
    86 
    87 	@Override
    88 	public boolean isClosed() throws SQLException {
    89 		throw new SQLException("Not supported yet.");
    90 	}
    91 
    92 	@Override
    93 	public DatabaseMetaData getMetaData() throws SQLException {
    94 		throw new SQLException("Not supported yet.");
    95 	}
    96 
    97 	@Override
    98 	public void setReadOnly(boolean readOnly) throws SQLException {
    99 		throw new SQLException("Not supported yet.");
   100 	}
   101 
   102 	@Override
   103 	public boolean isReadOnly() throws SQLException {
   104 		throw new SQLException("Not supported yet.");
   105 	}
   106 
   107 	@Override
   108 	public void setCatalog(String catalog) throws SQLException {
   109 		throw new SQLException("Not supported yet.");
   110 	}
   111 
   112 	@Override
   113 	public String getCatalog() throws SQLException {
   114 		throw new SQLException("Not supported yet.");
   115 	}
   116 
   117 	@Override
   118 	public void setTransactionIsolation(int level) throws SQLException {
   119 		throw new SQLException("Not supported yet.");
   120 	}
   121 
   122 	@Override
   123 	public int getTransactionIsolation() throws SQLException {
   124 		throw new SQLException("Not supported yet.");
   125 	}
   126 
   127 	@Override
   128 	public SQLWarning getWarnings() throws SQLException {
   129 		throw new SQLException("Not supported yet.");
   130 	}
   131 
   132 	@Override
   133 	public void clearWarnings() throws SQLException {
   134 		throw new SQLException("Not supported yet.");
   135 	}
   136 
   137 	@Override
   138 	public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
   139 		throw new SQLException("Not supported yet.");
   140 	}
   141 
   142 	@Override
   143 	public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
   144 		throw new SQLException("Not supported yet.");
   145 	}
   146 
   147 	@Override
   148 	public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
   149 		throw new SQLException("Not supported yet.");
   150 	}
   151 
   152 	@Override
   153 	public Map<String, Class<?>> getTypeMap() throws SQLException {
   154 		throw new SQLException("Not supported yet.");
   155 	}
   156 
   157 	@Override
   158 	public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
   159 		throw new SQLException("Not supported yet.");
   160 	}
   161 
   162 	@Override
   163 	public void setHoldability(int holdability) throws SQLException {
   164 		throw new SQLException("Not supported yet.");
   165 	}
   166 
   167 	@Override
   168 	public int getHoldability() throws SQLException {
   169 		throw new SQLException("Not supported yet.");
   170 	}
   171 
   172 	@Override
   173 	public Savepoint setSavepoint() throws SQLException {
   174 		throw new SQLException("Not supported yet.");
   175 	}
   176 
   177 	@Override
   178 	public Savepoint setSavepoint(String name) throws SQLException {
   179 		throw new SQLException("Not supported yet.");
   180 	}
   181 
   182 	@Override
   183 	public void rollback(Savepoint savepoint) throws SQLException {
   184 		throw new SQLException("Not supported yet.");
   185 	}
   186 
   187 	@Override
   188 	public void releaseSavepoint(Savepoint savepoint) throws SQLException {
   189 		throw new SQLException("Not supported yet.");
   190 	}
   191 
   192 	@Override
   193 	public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
   194 		throw new SQLException("Not supported yet.");
   195 	}
   196 
   197 	@Override
   198 	public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
   199 		throw new SQLException("Not supported yet.");
   200 	}
   201 
   202 	@Override
   203 	public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
   204 		throw new SQLException("Not supported yet.");
   205 	}
   206 
   207 	@Override
   208 	public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
   209 		throw new SQLException("Not supported yet.");
   210 	}
   211 
   212 	@Override
   213 	public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
   214 		throw new SQLException("Not supported yet.");
   215 	}
   216 
   217 	@Override
   218 	public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
   219 		throw new SQLException("Not supported yet.");
   220 	}
   221 
   222 	@Override
   223 	public Clob createClob() throws SQLException {
   224 		throw new SQLException("Not supported yet.");
   225 	}
   226 
   227 	@Override
   228 	public Blob createBlob() throws SQLException {
   229 		throw new SQLException("Not supported yet.");
   230 	}
   231 
   232 	@Override
   233 	public NClob createNClob() throws SQLException {
   234 		throw new SQLException("Not supported yet.");
   235 	}
   236 
   237 	@Override
   238 	public SQLXML createSQLXML() throws SQLException {
   239 		throw new SQLException("Not supported yet.");
   240 	}
   241 
   242 	@Override
   243 	public boolean isValid(int timeout) throws SQLException {
   244 		throw new SQLException("Not supported yet.");
   245 	}
   246 
   247 	@Override
   248 	public void setClientInfo(String name, String value) throws SQLClientInfoException {
   249 		throw new SQLClientInfoException("Not supported yet.", null);
   250 	}
   251 
   252 	@Override
   253 	public void setClientInfo(Properties properties) throws SQLClientInfoException {
   254 		throw new SQLClientInfoException("Not supported yet.", null);
   255 	}
   256 
   257 	@Override
   258 	public String getClientInfo(String name) throws SQLException {
   259 		throw new SQLException("Not supported yet.");
   260 	}
   261 
   262 	@Override
   263 	public Properties getClientInfo() throws SQLException {
   264 		throw new SQLException("Not supported yet.");
   265 	}
   266 
   267 	@Override
   268 	public Array createArrayOf(String typeName, Object[] elements) throws SQLException {
   269 		throw new SQLException("Not supported yet.");
   270 	}
   271 
   272 	@Override
   273 	public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
   274 		throw new SQLException("Not supported yet.");
   275 	}
   276 
   277 	@Override
   278 	public void setSchema(String schema) throws SQLException {
   279 		throw new SQLException("Not supported yet.");
   280 	}
   281 
   282 	@Override
   283 	public String getSchema() throws SQLException {
   284 		throw new SQLException("Not supported yet.");
   285 	}
   286 
   287 	@Override
   288 	public void abort(Executor executor) throws SQLException {
   289 		throw new SQLException("Not supported yet.");
   290 	}
   291 
   292 	@Override
   293 	public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException {
   294 		throw new SQLException("Not supported yet.");
   295 	}
   296 
   297 	@Override
   298 	public int getNetworkTimeout() throws SQLException {
   299 		throw new SQLException("Not supported yet.");
   300 	}
   301 
   302 	@Override
   303 	public <T> T unwrap(Class<T> iface) throws SQLException {
   304 		throw new SQLException("Not supported yet.");
   305 	}
   306 
   307 	@Override
   308 	public boolean isWrapperFor(Class<?> iface) throws SQLException {
   309 		throw new SQLException("Not supported yet.");
   310 	}
   311 }