Skip to content

Commit e203fea

Browse files
committed
fix: fetching conditional.
1 parent bce0255 commit e203fea

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/main/java/com/code/advancedsql/query/ExecuteQuery.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ public Map<String, Object> fetch() throws SQLException {
3333

3434
ResultSet resultSet = this.execute();
3535

36-
if (resultSet == null) return null;
37-
38-
resultSet.next();
36+
if (resultSet == null || !resultSet.next()) return null;
3937

4038
ResultSetMetaData metaData = resultSet.getMetaData();
4139

src/main/java/com/code/advancedsql/table/Table.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ public boolean exists() throws SQLException {
2626

2727
ResultSet tables = metaData.getTables(null, null, this.name, null);
2828

29+
boolean next = tables.next();
30+
2931
String name = tables.getString("TABLE_NAME");
3032

31-
return tables.next() && name != null && name.equals(this.name);
33+
return next && name != null && name.equals(this.name);
3234
}
3335

3436
@Override

0 commit comments

Comments
 (0)