I did write something trivial <https://github.com/andhapp/tune_my_query> a couple of years ago that ensured ILIKE (postgres on production) was switched to LIKE (mysql on development) for gemcutter (rubygems now-a-days). It never got used though, as gemcutter team found a better way to do it. I never really found another use-case to develop it further.
More than happy to work on it with someone. Anuj On 22 May 2013 03:07, Rafael Almeida <[email protected]> wrote: > I can't think of a better way, can you? Maybe I'm not strong enough with > sql to see it. Maybe there are other ways to do it, but I hardly think it > would be better. Anyway, since keeping compatible with sqlite is important, > maybe there could be an "extra-mysql-features" sort of gem to extend > ActiveRecord behaviour. Is there something like that already? I know there > are a few extensions to activerecord behaviour, but is there something > targeting making it support more features of certain databases? > > On Tuesday, May 21, 2013 1:18:36 PM UTC-3, Ryan Bigg wrote: >> >> I think this syntax wouldn't be supported in SQLite based on this SO >> answer: http://stackoverflow.**com/questions/1474964/using-** >> tuples-in-sql-in-clause<http://stackoverflow.com/questions/1474964/using-tuples-in-sql-in-clause> >> >> Maybe there is a better way to write this query? >> >> >> On Tue, May 21, 2013 at 12:13 PM, Rafael Almeida <[email protected]>wrote: >> >>> I would very much be able to do this query with ActiveRecord: >>> >>> SELECT `phones`.* FROM `phones` WHERE (ddd, number) in >>> ((31,32310512),(31,96438112)) >>> >>> Unfortunately, ActiveRecord gives me no way to do so with a prepared >>> statement. The intuitive way to do it would be: >>> >>> Phone.where('(ddd, number) in (?)', [[31,32310512],[31,96438112]]** >>> ) >>> >>> that does not work, as it yields: >>> >>> SELECT `phones`.* FROM `phones` WHERE ((ddd, number) in ('---\n- 31\n- >>> 32310512\n','---\n- 31\n- 96438112\n')) >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Ruby on Rails: Core" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to rubyonrails-co...@**googlegroups.com. >>> To post to this group, send email to rubyonra...@googlegroups.**com. >>> Visit this group at http://groups.google.com/** >>> group/rubyonrails-core?hl=en<http://groups.google.com/group/rubyonrails-core?hl=en> >>> . >>> For more options, visit >>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >>> . >>> >>> >>> >> >> -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- Anuj DUTTA -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
