| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- package org.es.jdbc.api;
- 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 FETCH_FORWARD;
- }
- @Override
- public int getType() throws SQLException {
- return TYPE_FORWARD_ONLY;
- }
- @Override
- public int getConcurrency() throws SQLException {
- return CONCUR_READ_ONLY;
- }
- @Override
- public Statement getStatement() throws SQLException {
- return statement;
- }
- @Override
- public int getHoldability() throws SQLException {
- return 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);
- }
- }
|