Skip to content

Commit

Permalink
Merge pull request #40 from citrusframework/enhancement/29/removeAcce…
Browse files Browse the repository at this point in the history
…ssChecks

(#29) Removed access validation
  • Loading branch information
svettwer authored Mar 7, 2019
2 parents ccb9e36 + 893e541 commit 0f9b31c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 1,079 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ public JdbcResultSet(final DataSet dataSet, final JdbcStatement statement) {

@Override
public boolean next() throws SQLException {
ensureNotClosed();
row = dataSet.getNextRow();
return row != null;
}
Expand All @@ -78,57 +77,46 @@ public void close() throws SQLException {
}

public String getString(final int columnIndex) throws SQLException {
validateAccess();
return (String) row.getValue(columnIndex-1, String.class);
}

public String getString(final String columnName) throws SQLException {
validateAccess();
return (String) row.getValue(columnName, String.class);
}

public float getFloat(final int columnIndex) throws SQLException {
validateAccess();
return (float) row.getValue(columnIndex-1, float.class);
}

public float getFloat(final String columnName) throws SQLException {
validateAccess();
return (float) row.getValue(columnName, float.class);
}

public int getInt(final int columnIndex) throws SQLException {
validateAccess();
return (int) row.getValue(columnIndex-1, int.class);
}

public int getInt(final String columnName) throws SQLException {
validateAccess();
return (int) row.getValue(columnName, int.class);
}

public boolean getBoolean(final int columnIndex) throws SQLException {
validateAccess();
return (boolean) row.getValue(columnIndex-1, boolean.class);
}

public byte getByte(final int columnIndex) throws SQLException {
validateAccess();
return (byte) row.getValue(columnIndex-1, byte.class);
}

public short getShort(final int columnIndex) throws SQLException {
validateAccess();
return (short) row.getValue(columnIndex-1, short.class);
}

public long getLong(final int columnIndex) throws SQLException {
validateAccess();
return (long) row.getValue(columnIndex-1, long.class);
}

public double getDouble(final int columnIndex) throws SQLException {
validateAccess();
return (double) row.getValue(columnIndex-1, double.class);
}

Expand All @@ -137,22 +125,18 @@ public BigDecimal getBigDecimal(final int columnIndex, final int scale) throws S
}

public byte[] getBytes(final int columnIndex) throws SQLException {
validateAccess();
return (byte[]) row.getValue(columnIndex-1, byte[].class);
}

public Date getDate(final int columnIndex) throws SQLException {
validateAccess();
return (Date) row.getValue(columnIndex-1, Date.class);
}

public Time getTime(final int columnIndex) throws SQLException {
validateAccess();
return (Time) row.getValue(columnIndex-1, Time.class);
}

public Timestamp getTimestamp(final int columnIndex) throws SQLException {
validateAccess();
return (Timestamp) row.getValue(columnIndex-1, Timestamp.class);
}

Expand All @@ -169,37 +153,30 @@ public InputStream getBinaryStream(final int columnIndex) throws SQLException {
}

public Object getObject(final int columnIndex) throws SQLException {
validateAccess();
return row.getValue(columnIndex-1);
}

public BigDecimal getBigDecimal(final int columnIndex) throws SQLException {
validateAccess();
return (BigDecimal) row.getValue(columnIndex-1, BigDecimal.class);
}

public boolean getBoolean(final String columnName) throws SQLException {
validateAccess();
return (boolean) row.getValue(columnName, boolean.class);
}

public byte getByte(final String columnName) throws SQLException {
validateAccess();
return (byte) row.getValue(columnName, byte.class);
}

public short getShort(final String columnName) throws SQLException {
validateAccess();
return (short) row.getValue(columnName, short.class);
}

public long getLong(final String columnName) throws SQLException {
validateAccess();
return (long) row.getValue(columnName, long.class);
}

public double getDouble(final String columnName) throws SQLException {
validateAccess();
return (double) row.getValue(columnName, double.class);
}

Expand All @@ -208,32 +185,26 @@ public BigDecimal getBigDecimal(final String columnName, final int scale) throws
}

public byte[] getBytes(final String columnName) throws SQLException {
validateAccess();
return (byte[]) row.getValue(columnName, byte[].class);
}

public Date getDate(final String columnName) throws SQLException {
validateAccess();
return (Date) row.getValue(columnName, Date.class);
}

public Time getTime(final String columnName) throws SQLException {
validateAccess();
return (Time) row.getValue(columnName, Time.class);
}

public Timestamp getTimestamp(final String columnName) throws SQLException {
validateAccess();
return (Timestamp) row.getValue(columnName, Timestamp.class);
}

public Object getObject(final String columnName) throws SQLException {
validateAccess();
return row.getValue(columnName);
}

public BigDecimal getBigDecimal(final String columnName) throws SQLException {
validateAccess();
return (BigDecimal) row.getValue(columnName, BigDecimal.class);
}

Expand Down Expand Up @@ -266,7 +237,6 @@ public ResultSetMetaData getMetaData() throws SQLException {
}

public int findColumn(final String columnName) throws SQLException {
validateAccess();
return row.getColumns().indexOf(columnName)+1;
}

Expand Down Expand Up @@ -311,7 +281,6 @@ public boolean last() throws SQLException {
}

public int getRow() throws SQLException {
ensureNotClosed();
return dataSet.getCursor();
}

Expand Down Expand Up @@ -536,7 +505,6 @@ public void moveToCurrentRow() throws SQLException {
}

public Statement getStatement() throws SQLException {
ensureNotClosed();
return statement;
}

Expand Down Expand Up @@ -866,7 +834,6 @@ public <T> T getObject(final String columnLabel, final Class<T> type) throws SQL
}

public boolean wasNull()throws SQLException {
validateAccess();
return row.getLastValue() == null;
}

Expand Down Expand Up @@ -918,25 +885,7 @@ public Array getArray(final String colName) throws SQLException {
throw new SQLException("Not supported JDBC result set function 'getArray'");
}

private void validateAccess() throws SQLException {
ensureValidCursor();
ensureNotClosed();
}

private void ensureValidCursor() throws SQLException {
if(row == null){
throw new SQLException("No further data - Cursor position is after last row");
}
}

private void ensureNotClosed() throws SQLException {
if(isClosed()){
throw new SQLException("Result set already closed");
}
}

private boolean rowModified() throws SQLException {
ensureNotClosed();
private boolean rowModified() {
return !dataSet.getRows().isEmpty();
}

Expand Down
Loading

0 comments on commit 0f9b31c

Please sign in to comment.