rails / arel

A Relational Algebra
2.06k stars 390 forks source link

Add database specific string concatenation #410

Closed kbrock closed 8 years ago

kbrock commented 8 years ago

Hi All

String concatenation is database specific.

Postgres (and ANSI SQL) supports column1 || column2, but databases like mysql use concat(column1, column2).

This PR introduces string concatenation to Arel to abstract this nuance. e.g.: table[:name].concat(other). Before this, developers needed to build database specific sql on their own.

If Arel is not the right place for this abstraction, do you have any suggestions on how to abstract this in my own app?

Thanks, Keenan

/cc @fryguy @matthewd (and of course @tenderlove ) This is for ancestry, but I feel we want something similar in our spot as well.

rails-bot commented 8 years ago

r? @rafaelfranca

(@rails-bot has picked a reviewer for you, use r? to override)

kbrock commented 8 years ago

It looks like #173 was closed, but not exactly sure why. Is it because this is not the right layer for this abstraction, or because that PR not support mysql?

Thanks

kbrock commented 8 years ago

@rafaelfranca Does this look like something that could go into Arel?

thanks

rafaelfranca commented 8 years ago

Yes. It makes sense. Thank you for the pull request.