Thank you very much! Indeed placeholder is nicer.
On 07/03/2012 07:29 PM, Chris Corbyn wrote:
You need to use single quote around the LIKE expression.  Double quotes are for 
quoting field/table names in the SQL standard.  Alternatively, pass the 
expression in via a placeholder (safer):

adapter.select("SELECT eid FROM ttable WHERE ab  = ? AND cd LIKE ?", 1, 
"%_ABC_%")


Il giorno 04/lug/2012, alle ore 08:03, pipehappy ha scritto:

Hi,

I have a quick question. I want to run something like this:
...
@abc = "SELECT eid from ttable where ab = 1 AND cd like \"%_ABC_%\""
...
res = DataMapper.repository.adapter.select(@abc)

datamapper throws out this error:
in `execute_reader': Unknown column '%_ABC_%' in 'where
clause' (DataObjects::SQLError)

Anyone suggests any opinion on this?

Best,

--
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.



--
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to