Skip to content

Conversation

rachid
Copy link

@rachid rachid commented Jun 9, 2011

added REGEXP_LIKE statements to make matches case insensitive when using the oracle_enhanced adapter

@tenderlove
Copy link
Member

@rsim what do you think of this?

@rsim
Copy link

rsim commented Jun 25, 2011

As I understand Arel "matches" method semantics is that it will find matching records with SQL LIKE operator and therefore matching string can use LIKE wildcards such as % and _.
Oracle's REGEXP_LIKE function will find matching operators using regular expression for finding matching records and therefore it will have quite different behavior compared to SQL LIKE.

Probably Arel needs two different methods, e.g. existing "matches" for SQL LIKE and then maybe matches_regexp, which can be implemented for databases which support regular expression matching.

@rachid
Copy link
Author

rachid commented Jun 26, 2011

@rsim you are absolutely right, it isn't not the same behaviour, the main reason I wanted to use REGEXP_LIKE is the same fact as ILIKE is being used for PostgreSQL, authors hooking into Arel assume the LIKE behaviour isn't case sensitive.
I am using rails intensively with oracle lately, this 'patch' makes it easier, but I agree with you it could cause some unexpected behaviour in the future.

Also like your second suggestion, but I think that won't be needed as we can easily do custom SQL in rare situations when needing regular expressions in queries.

I will close this request for now, aiming to come up with a better solution.

@rachid rachid closed this Jun 26, 2011
@kassio kassio mentioned this pull request Oct 12, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants