You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Juozas Baliuka <ba...@centras.lt> on 2003/03/01 08:30:48 UTC
Re: [dbutils] query with results
ok, we will add this, I was not sure it can be usefull.
Do we need to call "getMoreResults()" before or affter "getResultSet". As I
understand documentation
we must call "getResultSet" first (I have never used it in practice).
----- Original Message -----
From: "george stewart" <gs...@us-south.net>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Friday, February 28, 2003 8:57 PM
Subject: Re: [dbutils] query with results
> "Juozas Baliuka" <ba...@centras.lt> writes:
>
> > Do you know some use case for this ?
> >
> > As I understand it must look like this:
> >
> > ResultSet last = null;
> > try{
> > if (pstmt.execute()) {//it can be update or select
> > do{
> > last = pstmt.getResultSet();
> > rsh.handle(last);
> > }while(pstmt.getMoreResults()); //closes resultset and
> > retrieves next;
> > }
> > }finally{
> > close(last);
> > }
> >
> >
>
> One commonly used case is for retrieving a identity for databases which
support that.
>
> For sql server, "SELECT @@identity" would follow you insert statement.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org