ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ken Katsma <kenkat...@gmail.com>
Subject Re: Oracle function result sets with iBatis
Date Sun, 16 Jan 2005 06:04:08 GMT
Sure,  see my comments through the following....

I just added a check to see if the database was oracle

 if
> (conn.getMetaData().getDatabaseProductName().equalsIgnoreCase("Oracle"))
>       {

And if it is, then don't do a query, do an execute....

>  boolean b = cs.execute();
>
>  errorContext.setMoreInfo("In Oracle query mode.");
>  errorContext.setMoreInfo("Check the output parameters
>  (retrieval of output parameters failed).");

Grab the output parameters, and find the one that's a resultset.

>  retrieveOutputParameters(cs, mappings, parameters);
>
>  for (int i=0;i<parameters.length;i++)
>  {
>  if (parameters[i] instanceof ResultSet)
>  {
>  rs = (ResultSet) parameters[i];
>  break;
>  }
>  }
>

Then perform handle results...

>  errorContext.setMoreInfo("Check the results (failed to
>  retrieve results).");
>  handleResults(request, rs, skipResults, maxResults, callback);
>  }

Otherwise, just do the traditional executeQuery.

>  else
>  {
>  errorContext.setMoreInfo("In non-Oracle mode.");
>  rs = cs.executeQuery();
>
>  errorContext.setMoreInfo("Check the results (failed to retrieve
>  results).");
>  handleResults(request, rs, skipResults, maxResults, callback);
>
>  errorContext.setMoreInfo("Check the output parameters (retrieval
>  of output parameters failed).");
>  retrieveOutputParameters(cs, mappings, parameters);
>  }
>  } finally {
>  try {
>  closeResultSet(rs);
>  } finally {
>  closeStatement(cs);
>  }
>  }

If you need anything more let me know, thanks.

Clinton Begin wrote:

>Could you explain more clearly what you changed?  
>
>Clinton
>
>
>  
>

Mime
View raw message