package org.araqne.logdb.jdbc;
import java.io.IOException;
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.Statement;
import java.sql.Struct;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.Executor;
import org.araqne.logdb.client.LogDbClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class LogdbConnection implements Connection {
private final Logger slog = LoggerFactory.getLogger(LogdbConnection.class);
private LogDbClient client;
public LogdbConnection(LogDbClient client) {
System.out.println("connected");
this.client = client;
}
@Override
public boolean isClosed() throws SQLException {
return client.isClosed();
}
@Override
public void close() throws SQLException {
try {
System.out.println("closed");
client.close();
} catch (IOException e) {
throw new SQLException(e);
}
}
@Override
public Statement createStatement() throws SQLException {
return new LogdbStatement(client, 0, 0, 0);
}
@Override
public PreparedStatement prepareStatement(String sql) throws SQLException {
return new LogdbPreparedStatement(client, sql, 0, 0, 0);
}
@Override
public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
throw new UnsupportedOperationException("createStatement(int, int)");
}
@Override
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
throw new UnsupportedOperationException("prepareStatement(String, int, int)");
}
@Override
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
throw new UnsupportedOperationException("createStatement(String, int, int )");
}
@Override
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
throws SQLException {
throw new UnsupportedOperationException("prepareStatement(String, int, int, int)");
}
@Override
public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
throw new UnsupportedOperationException("prepareStatement(String, autoGeneratedKeys)");
}
@Override
public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
throw new UnsupportedOperationException("prepareStatement(String, int[])");
}
@Override
public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
throw new UnsupportedOperationException("prepareStatement(String, String[])");
}
@Override
public <T> T unwrap(Class<T> iface) throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public boolean isWrapperFor(Class<?> iface) throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public CallableStatement prepareCall(String sql) throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public String nativeSQL(String sql) throws SQLException {
return sql;
}
@Override
public void setAutoCommit(boolean autoCommit) throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public boolean getAutoCommit() throws SQLException {
return false;
}
@Override
public void commit() throws SQLException {
}
@Override
public void rollback() throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public DatabaseMetaData getMetaData() throws SQLException {
return new LogdbMetaData();
}
@Override
public void setReadOnly(boolean readOnly) throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public boolean isReadOnly() throws SQLException {
return false;
}
@Override
public void setCatalog(String catalog) throws SQLException {
// TODO Auto-generated method stub
}
@Override
public String getCatalog() throws SQLException {
// TODO Auto-generated method stub
return null;
}
@Override
public void setTransactionIsolation(int level) throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public int getTransactionIsolation() throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public SQLWarning getWarnings() throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public void clearWarnings() throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public Map<String, Class<?>> getTypeMap() throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public void setHoldability(int holdability) throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public int getHoldability() throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public Savepoint setSavepoint() throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public Savepoint setSavepoint(String name) throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public void rollback(Savepoint savepoint) throws SQLException {
}
@Override
public void releaseSavepoint(Savepoint savepoint) throws SQLException {
}
@Override
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public Clob createClob() throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public Blob createBlob() throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public NClob createNClob() throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public SQLXML createSQLXML() throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public boolean isValid(int timeout) throws SQLException {
// TODO Auto-generated method stub
return false;
}
@Override
public void setClientInfo(String name, String value) throws SQLClientInfoException {
// TODO Auto-generated method stub
}
@Override
public void setClientInfo(Properties properties) throws SQLClientInfoException {
// TODO Auto-generated method stub
}
@Override
public String getClientInfo(String name) throws SQLException {
// TODO Auto-generated method stub
return null;
}
@Override
public Properties getClientInfo() throws SQLException {
// TODO Auto-generated method stub
return null;
}
@Override
public Array createArrayOf(String typeName, Object[] elements) throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
throw new UnsupportedOperationException();
}
@Override
public void setSchema(String schema) throws SQLException {
// TODO Auto-generated method stub
}
@Override
public String getSchema() throws SQLException {
// TODO Auto-generated method stub
return null;
}
@Override
public void abort(Executor executor) throws SQLException {
// TODO Auto-generated method stub
}
@Override
public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException {
// TODO Auto-generated method stub
}
@Override
public int getNetworkTimeout() throws SQLException {
// TODO Auto-generated method stub
return 0;
}
}