You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have recently upgraded my driver from jaybird 4.0.9 to 5.0.4 and I found a different behaviour for the ResultSet.isBeforeFirst method call when the result set is empty.
In version 4.0.9 the method correctly returns false if the query has no rows in the result set, instead in version 5.0.4 it returns true. In this way we no longer have the possibility of understanding whether a result set is empty or not.
It seems that this change was made while developing support for server-side scrolling in #693, by changing the initialization value of the variable isBeforeFirst in FbStatementFetcher
As a test query you can use:
SELECT1as myvar
FROM rdb$database
WHERE1=0
and you get a different result executing the following code by changing the driver
varconn = DriverManager.getConnection(url, user, pass);
varstmt = conn.createStatement();
varquery = "SELECT 1 as myvar FROM rdb$database WHERE 1=0"ResultSetrs = stmt.executeQuery(strSQL);
if(!rs.isBeforeFirst()) {
System.out.println("Result set is empty");
} else {
System.out.println("Result set with records");
}
The text was updated successfully, but these errors were encountered:
Thanks for reporting. I'll need to double check why I changed this. I guess I did it for consistency with the scrollable fetch, but the JDBC specification indeed says it should report false when the result set is empty.
I have recently upgraded my driver from jaybird 4.0.9 to 5.0.4 and I found a different behaviour for the ResultSet.isBeforeFirst method call when the result set is empty.
In version 4.0.9 the method correctly returns
false
if the query has no rows in the result set, instead in version 5.0.4 it returnstrue
. In this way we no longer have the possibility of understanding whether a result set is empty or not.It seems that this change was made while developing support for server-side scrolling in #693, by changing the initialization value of the variable isBeforeFirst in FbStatementFetcher
As a test query you can use:
and you get a different result executing the following code by changing the driver
The text was updated successfully, but these errors were encountered: