com.tigergraph.jdbc.common.Statement Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tigergraph-jdbc-driver Show documentation
Show all versions of tigergraph-jdbc-driver Show documentation
This project is a type 4 jdbc driver which implemented the standard jdbc interface. It supports connectivity to tigergraph server and varieties of query types.
package com.tigergraph.jdbc.common;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.SQLWarning;
public abstract class Statement implements java.sql.Statement {
protected Connection connection;
protected ResultSet currentResultSet;
protected int fetchSize;
protected int timeout = -1;
/** Default constructor. */
protected Statement(Connection connection) {
this.connection = connection;
this.currentResultSet = null;
}
@Override
public Connection getConnection() throws SQLException {
return this.connection;
}
@Override
public void setFetchSize(int rows) throws SQLException {
this.fetchSize = rows;
return;
}
@Override
public ResultSet getResultSet() throws SQLException {
ResultSet rs = this.currentResultSet;
this.currentResultSet = null;
return rs;
}
@Override
public void close() throws SQLException {
return; // Nothing to do
}
@Override
public void setQueryTimeout(int seconds) throws SQLException {
if (seconds < 0) {
throw new SQLException("Timeout should be greater than or equal to 0.");
}
// The unit of timeout for TigerGraph is millisecond.
timeout = seconds * 1000;
}
@Override
public int getQueryTimeout() throws SQLException {
return timeout / 1000;
}
/*
* Abstract Methods.
*/
@Override
public abstract boolean execute(String sql) throws SQLException;
@Override
public abstract ResultSet executeQuery(String sql) throws SQLException;
@Override
public abstract int executeUpdate(String sql) throws SQLException;
@Override
public abstract int getResultSetHoldability() throws SQLException;
@Override
public abstract int getResultSetConcurrency() throws SQLException;
@Override
public abstract int getResultSetType() throws SQLException;
/*
* Methods not implemented yet.
*/
@Override
public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public boolean execute(String sql, int[] columnIndexes) throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public boolean execute(String sql, String[] columnNames) throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public int executeUpdate(String sql, int[] columnIndexes) throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public int executeUpdate(String sql, String[] columnNames) throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public int getMaxFieldSize() throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public void setMaxFieldSize(int max) throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public void setEscapeProcessing(boolean enable) throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public void setCursorName(String name) throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public void setFetchDirection(int direction) throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public int getFetchDirection() throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public int getFetchSize() throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public boolean getMoreResults(int current) throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public ResultSet getGeneratedKeys() throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public void cancel() throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public void setPoolable(boolean poolable) throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public boolean isPoolable() throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public void addBatch(String sql) throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public void clearBatch() throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public int[] executeBatch() throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public void closeOnCompletion() throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public boolean isCloseOnCompletion() throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public T unwrap(Class iface) throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public boolean isWrapperFor(Class> iface) throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public int getMaxRows() throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public void setMaxRows(int max) throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public boolean getMoreResults() throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public SQLWarning getWarnings() throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public void clearWarnings() throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public int getUpdateCount() throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public boolean isClosed() throws SQLException {
throw new UnsupportedOperationException("Not implemented yet.");
}
}