views:

5

answers:

0

I'm adding SQLite support to a Rails 2.3 codebase designed for MySQL.

Most of the changes so far have been fairly straightforward, but I've now found some examples like the following code:

SomeModel.find(:first,
  :conditions => ["? LIKE CONCAT(some_attribute, '%')", a_variable]
)

I can't just use the ANSI concatenation operator because the double-pipes mean something else to MySQL. That is to say, the following code passes on SQLite3 but fails on MySQL:

SomeModel.find(:first,
  :conditions => ["? LIKE some_attribute || '%')", a_variable]
)

Is there something I cleaner I can do than some kind of case database_adapter when :mysql ...?