Marc Herbert <[EMAIL PROTECTED]> writes:
> Zsolt Simon <[EMAIL PROTECTED]> writes:
>
>> On Thu, 2006-02-23 at 17:15 +0100, Marc Herbert wrote:
>>> *
>>> * @return pointer to the current result set; null if there are no more
>>> */
>>> - DriverResultSet* getResultSet() const { return lastResultPtr; }
>>> + DriverResultSet& getResultSet() const { return *lastResultPtr; }
>>
>> Just one question ... what will happen with getResultSet() when
>> lastResultPtr is null?
By the way a ResultSet is never null in JDBC:
<http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Statement.html#executeQuery(java.lang.String)>
> Actually it seems this method is not needed to detect the end of the
> list, since there is the (recommended in JDBC) getMoreResults() method
> to do that, which you have to use anyway when walking the ResultSet
> list.
JDBC's getResultSet() method returns null when the current result is
an update count *OR* there are no more results. So "null" returned
from this method cannot be used to detect _anything_ reliably in JDBC:
neither the end of the list, nor the type of the current result (there
are other methods for this).
IMHO getResultSet() returning "null" does not mean anything, it just
means that the programmer made a mistake, calling it at the wrong
time. If JDBC decides that method is now throwing an exception
instead of returning a null, this would not change the API a lot and
most JDBC applications would probably be unharmed.
Don't take me wrong: I don't like how JDBC browses result lists. But I
think that is not a reason to introduce subtle semantic differences
with it! if we don't like something in JDBC, then we better _frankly_
depart from it than having hidden small changes that create
confusion. Else let's stick to JDBC as close as possible.
Coming back to getResults(), we have in JDBC:
@return the current result as a <code>ResultSet</code> object or null
if the programmer made a mistake :-)
So I think we can safely return a reference or throw an exception in C++
How does libmysequoia uses getResult() ?
_______________________________________________
Carob mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob