hi brian,

i ran a small test using hsqldb:

        Criteria crit = new Criteria();
        crit.addEqualTo("lastname", "o'leary");
        Query q = QueryFactory.newQuery(Person.class, crit);

        Collection results = broker.getCollectionByQuery(q);

this is what p6spy reported:

the prepared statement :
SELECT A0.LASTNAME,A0.FIRSTNAME,A0.ID FROM PERSON A0 WHERE A0.LASTNAME = ?

? is replaced by setObject() using java.sql.Types.VARCHAR

SELECT A0.LASTNAME,A0.FIRSTNAME,A0.ID FROM PERSON A0 WHERE A0.LASTNAME = 
'o'leary'

imo the jdbc-driver takes care of double-quoting.

hth
jakob


Jakob Braeuchi schrieb:

hi brian,

ojb simply passes the the search argument to the jdbc-driver using setObject() and the like. i'll check it with hsqldb.

you'd better use the platform to implement dbms-specific features.
see setObjectForStatement()

jakob

Brian Chaplin schrieb:

I'm using Sybase and need to search for a quoted string like "O'Hare
Airport"

In Sybase, when quoted_identifier is set on, this must be specified as
'O''Hare Airport'

OJB is using 'O'Hare Airport' which causes a SQL errror.
I assume I have to subclass the Sybase JCBC Implementation JDBCAccessImpl to
do this and set quoted_identifer off and plug that class into
JdbcAccessClass?





--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to