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 datamapper@googlegroups.com. > To unsubscribe from this group, send email to > datamapper+unsubscr...@googlegroups.com. > 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 datamapper@googlegroups.com. To unsubscribe from this group, send email to datamapper+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/datamapper?hl=en.