| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- package org.elasticsearch.jdbc;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.sql.SQLWarning;
- import java.sql.Statement;
- public abstract class AbstractResultSet extends AbstractFeatureNotSupportedResultSet {
- protected boolean isClosed = false;
- protected Statement statement;
- public AbstractResultSet(Statement statement) {
- this.statement = statement;
- }
- @Override
- public void close() throws SQLException {
- isClosed = true;
- }
- @Override
- public boolean isClosed() throws SQLException {
- return isClosed;
- }
- @Override
- public int findColumn(String columnLabel) throws SQLException {
- //aways return first col
- return 1;
- }
- @Override
- public boolean wasNull() throws SQLException {
- return false;
- }
- @Override
- public SQLWarning getWarnings() throws SQLException {
- return null;
- }
- @Override
- public void clearWarnings() throws SQLException {
- // ignore
- }
- @Override
- public int getFetchDirection() throws SQLException {
- return ResultSet.FETCH_FORWARD;
- }
- @Override
- public int getType() throws SQLException {
- return ResultSet.TYPE_FORWARD_ONLY;
- }
- @Override
- public int getConcurrency() throws SQLException {
- return ResultSet.CONCUR_READ_ONLY;
- }
- @Override
- public Statement getStatement() throws SQLException {
- return statement;
- }
- @Override
- public int getHoldability() throws SQLException {
- return ResultSet.CLOSE_CURSORS_AT_COMMIT;
- }
- @Override
- public Object getObject(int columnIndex) throws SQLException {
- return getString(columnIndex);
- }
- @Override
- public Object getObject(String columnLabel) throws SQLException {
- return getString(columnLabel);
- }
- @Override
- @SuppressWarnings("unchecked")
- public final <T> T unwrap(final Class<T> iface) throws SQLException {
- if (isWrapperFor(iface)) {
- return (T) this;
- }
- throw new SQLException(String.format("[%s] cannot be unwrapped as [%s]", getClass().getName(), iface.getName()));
- }
- @Override
- public final boolean isWrapperFor(final Class<?> iface) throws SQLException {
- return iface.isInstance(this);
- }
- }
|