db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <tfisc...@apache.org>
Subject ESCAPE clause in LIKE statement
Date Tue, 07 Nov 2006 22:23:25 GMT
>From an email of in the Users list:

> > > SELECT  * FROM CSFieldRegistry
> > > WHERE CSFieldRegistry.Name LIKE 'CSCLIENT\_%'
> > > AND CSFieldRegistry.CustomField=1
> > >
> > > Please observe the LIKE clause in the above query. It
> > >  works fine on
> > > MySQL as MySQL knows that a backslash (\) is an escape
> > > sequence for
> > > the underscore (_)
> > >
> > > But the query fails on Sybase as Sybase expects the query in the
> > > following form.
> > >
> > > SELECT  * FROM CSFieldRegistry
> > > WHERE CSFieldRegistry.Name LIKE 'CSCLIENT\_%'  escape '\'
> > > AND CSFieldRegistry.CustomField=1

One can add the "escape" clause by overriding the useEscapeClauseForLike() 
method in the adapte now, so I changed that for sybase. I have no idea 
whether this is needed in ms-sql also, so I left it at no escape 
character for ms-sql.

I have checked this for sybase, oracle, mysql, postgres, and derby. I'll 
check it for firebird, but I am not sure about the other databases. 
Especially, I am not sure about mssql.

Would anyone having access to mssql rmind to run the test project and 
check whether it throws any errors ?

    Cheers,

       Thomas

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


Mime
View raw message