db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Kalén <mka...@apache.org>
Subject Re: Method check Platform.isCallableStatement is not sufficient
Date Fri, 22 Apr 2005 12:33:23 GMT
Armin Waibel wrote:
> after the changes made to support stored procedures returning 
> ResultSets, all MaxDB/SapDB tests fail, because the check for 
> CallableStatements made in Platform.isCallableStatement is not sufficient.
> 
> The MaxDB driver always retrun a Statement object which is instance of 
> CallableStatement, so OJB always assume a stored procedure was used. I 
> think this check is wrong:
> If instance of statement object is CallableStatement ==> a stored 
> procedure is used - is wrong!
> 
> Any suggestions how to fix this?

There is a "FIXME" from Vadim in StatementForClassImpl regarding detection
of PreparedStatement/CallableStatement. Currently it's a simple string comparison
saying "if SQL does not start with '{ ?= call' it is a PreparedStatement,
else it is a CallableStatement".

This logic is not too clever and needs to be improved (eg just leaving out
that first space will break it).

However, it seems strange that you should still get CallableStatement by
the driver since this check should not be prone to false positives (au contraire).


In the 1.0.x branch, can you verify that your statements are actually created
on line 285 of StatementsForClassImpl (and not on line 295)?


If this is the case I think the driver has a somewhat weird class structure...

Maybe you could try to write a really small stand-alone JDBC test class
and debug Connection#prepareStatement vs Connection#prepareCall and see
if there is anything in the class structure that can be used to separate
the two?

If you get a "separation hint" we could use this in OJB by overriding
Platform#isCallableStatement in PlatformSapdbImpl.

Regards,
  Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message