summaryrefslogtreecommitdiff
path: root/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/result_set_index_zero/ResultSetIndexZero.java
blob: de087faef79e691218e6811832d0d396d2a62a86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class ResultSetIndexZero {
    private static final int COLUMN_INDEX = 0;

    public void foo(ResultSet resultSet) throws SQLException {
        resultSet.getInt(<warning descr="Use of index '0' in JDBC ResultSet">0</warning>);
        resultSet.getInt(<warning descr="Use of index '0' in JDBC ResultSet">COLUMN_INDEX</warning>);
        resultSet.getInt(3);
    }

  void foo(PreparedStatement ps) throws SQLException {
    ps.setQueryTimeout(0);
    ps.setFetchDirection(0);
    ps.setFetchSize(0);
    ps.setMaxFieldSize(0);
    ps.setMaxRows(0);
  }
}