Skip to content

Commit

Permalink
Fixes #92 - Implement CSVDriver.connect method (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
mnriem authored Dec 14, 2023
1 parent a3667d6 commit 068b571
Show file tree
Hide file tree
Showing 10 changed files with 442 additions and 22 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
nb-configuration.xml
target/
/csv/nbproject/
7 changes: 7 additions & 0 deletions csv/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,11 @@
<artifactId>csv</artifactId>
<packaging>jar</packaging>
<name>Manorrock Guppy - CSV Driver</name>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
364 changes: 364 additions & 0 deletions csv/src/main/java/com/manorrock/guppy/csv/CSVConnection.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,364 @@
/*
* Copyright (c) 2002-2020, Manorrock.com. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package com.manorrock.guppy.csv;

import java.sql.Array;
import java.sql.Blob;
import java.sql.CallableStatement;
import java.sql.Clob;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.NClob;
import java.sql.PreparedStatement;
import java.sql.SQLClientInfoException;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.SQLXML;
import java.sql.Savepoint;
import java.sql.ShardingKey;
import java.sql.Statement;
import java.sql.Struct;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.Executor;

/**
* The Connection to the CSV file.
*
* @author Manfred Riem (mriem@manorrock.com)
*/
public class CSVConnection implements Connection {

/**
* Constructor.
*
* @param url the URL.
* @param info the information.
*/
public CSVConnection(String url, Properties info) {
}

@Override
public Statement createStatement() throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public PreparedStatement prepareStatement(String sql) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public CallableStatement prepareCall(String sql) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public String nativeSQL(String sql) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public void setAutoCommit(boolean autoCommit) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public boolean getAutoCommit() throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public void commit() throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public void rollback() throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public void close() throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public boolean isClosed() throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public DatabaseMetaData getMetaData() throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public void setReadOnly(boolean readOnly) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public boolean isReadOnly() throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public void setCatalog(String catalog) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public String getCatalog() throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public void setTransactionIsolation(int level) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public int getTransactionIsolation() throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public SQLWarning getWarnings() throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public void clearWarnings() throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public Map<String, Class<?>> getTypeMap() throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public void setHoldability(int holdability) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public int getHoldability() throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public Savepoint setSavepoint() throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public Savepoint setSavepoint(String name) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public void rollback(Savepoint savepoint) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public void releaseSavepoint(Savepoint savepoint) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public Clob createClob() throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public Blob createBlob() throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public NClob createNClob() throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public SQLXML createSQLXML() throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public boolean isValid(int timeout) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public void setClientInfo(String name, String value) throws SQLClientInfoException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public void setClientInfo(Properties properties) throws SQLClientInfoException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public String getClientInfo(String name) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public Properties getClientInfo() throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public Array createArrayOf(String typeName, Object[] elements) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public void setSchema(String schema) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public String getSchema() throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public void abort(Executor executor) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public int getNetworkTimeout() throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public void beginRequest() throws SQLException {
Connection.super.beginRequest();
}

@Override
public void endRequest() throws SQLException {
Connection.super.endRequest();
}

@Override
public boolean setShardingKeyIfValid(ShardingKey shardingKey, ShardingKey superShardingKey, int timeout) throws SQLException {
return Connection.super.setShardingKeyIfValid(shardingKey, superShardingKey, timeout);
}

@Override
public boolean setShardingKeyIfValid(ShardingKey shardingKey, int timeout) throws SQLException {
return Connection.super.setShardingKeyIfValid(shardingKey, timeout);
}

@Override
public void setShardingKey(ShardingKey shardingKey, ShardingKey superShardingKey) throws SQLException {
Connection.super.setShardingKey(shardingKey, superShardingKey);
}

@Override
public void setShardingKey(ShardingKey shardingKey) throws SQLException {
Connection.super.setShardingKey(shardingKey);
}

@Override
public <T> T unwrap(Class<T> iface) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public boolean isWrapperFor(Class<?> iface) throws SQLException {
throw new UnsupportedOperationException("Not supported yet.");
}

}
2 changes: 1 addition & 1 deletion csv/src/main/java/com/manorrock/guppy/csv/CSVDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public CSVDriver() {

@Override
public Connection connect(String url, Properties info) throws SQLException {
throw new UnsupportedOperationException();
return new CSVConnection(url, info);
}

@Override
Expand Down
Loading

0 comments on commit 068b571

Please sign in to comment.