feat(java): implement findColumn() in JDBC4ResultSet

This commit is contained in:
kimminseok
2025-10-07 14:02:10 +09:00
parent 497808a40c
commit fcb0323218
2 changed files with 84 additions and 1 deletions

View File

@@ -368,7 +368,13 @@ public final class JDBC4ResultSet implements ResultSet, ResultSetMetaData {
@Override
public int findColumn(String columnLabel) throws SQLException {
throw new UnsupportedOperationException("not implemented");
final String[] columnNames = resultSet.getColumnNames();
for (int i = 0; i < columnNames.length; i++) {
if (columnNames[i].equals(columnLabel)) {
return i + 1;
}
}
throw new SQLException("column name " + columnLabel + " not found");
}
@Override