db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Monroe" <Greg.Mon...@DukeCE.com>
Subject RE: ESCAPE clause in LIKE statement
Date Tue, 07 Nov 2006 22:59:04 GMT
Hmm, "anyone having access to mssql"... I wonder who 
he could be talking about..  8)

I'll see if I can pry myself away from Maven site 
design to try it...

FWIW - The MS SQL 2000 Docs indicate that there is 
no default escape character.  To use an escape char,
you must add an ESCAPE clause in the LIKE statement.

Sounds the same as Sybase (no surprise there...).

AFAIK, the SQL standard doesn't really specify a
default character, just the ESCAPE clause syntax 
for LIKE statements.

> -----Original Message-----
> From: Thomas Fischer [mailto:tfischer@apache.org] 
> Sent: Tuesday, November 07, 2006 5:23 PM
> To: torque-dev@db.apache.org
> Subject: ESCAPE clause in LIKE statement
> 
> 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
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are confidential communication
or may otherwise be privileged or confidential and are intended solely for the individual
or entity to whom they are addressed.  If you are not the intended recipient you may not rely
on the contents of this email or any attachments, and we ask that you  please not read, copy
or retransmit this communication, but reply to the sender and destroy the email, its contents,
and all copies thereof immediately.  Any unauthorized dissemination, distribution or copying
of this communication is strictly prohibited.



---------------------------------------------------------------------
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