Hello Everyone,

I added support to org.exolab.castor.jdo.engine.SQLEngine and
org.exolab.castor.jdo.PersistenceException to support "offending queries
and bind values".  When SQLEngine needs to throw an PersistenceException
because of a failed SQL query, it now adds the offending query and
associated bind variables to the Exception.

This PersistenceException has two new methods:

getSQLQuery() - returns the offending SQL query in a String if the
exception was thrown because of an error in the query.  If the
PersistenceException was thrown for some other reason, this method will
return null.

getBoundValues() - returns the variables that were bound in an array of
type Object if the exception was thrown because of an error in the
query.  If the PersistenceException was thrown for some other reason,
this method will return null.

I find this feature very useful in debugging situations -- especially
because Oracle doesn't seem to communicate useful information in it's
Exceptions.  For instance, when an attribute has a value that is too
large for a column.  Or when you are trying to perform a query in the
database and you have defined an incorrect column name in the mapping
file.  There are probably other ways this feature could be useful.

I have enclosed a patch based on a CVS snapshot from this afternoon.  It
is relative to the castor root directory.  I hope others find this
useful too.

Jim

-- 
James Connell [[EMAIL PROTECTED]]
Research Engineer II, IFS International

The reward of a thing well done is to have done it.  - Emerson

query_patch.jc

Reply via email to