Subject Re: Query returning row when it shouldn't...
Author Roman Rokytskyy
> I don't know what grokking is,

"grok" - To understand profoundly through intuition or empathy.
(Coined by Robert A. Heinlein in his Stranger in a Strange Land)

> This is valid, expected behaviour in an SQL sense, but I hesitate to
> agree that jdbc/java should wrap this perfectly 'as-is' without
> attempting to do something better with it.
> Maybe I *have* been living in a dreamworld working with SQLserver
> for the last 2 projects ;-)

I wouldn't call it dreamworld, but rather MS world. This issue is not
described by the standard, and if we implement it the way MS does,
that would break other application that rely on the standard and the
fact that JDBC driver does not do any interpretation of the result
set. Microsoft tends to ignore standards, we don't.

Since this seems to be MS-specific thing (tomorrow I will check IBM
DB2), you can always create your own JDBC driver adapter using dynamic
proxies and changing the meaning of the methods. You have to override
Connection.createStatement() and Connection.prepareStatement(String)
methods to instantiate your proxy that would check
Statement.executeQuery(String) and PreparedStatement.executeQuery()
methods and return empty result set under the conditions you described.

I cannot say that it would make sense to me, but it is pretty legal.

Roman