IssueRaiser

How exactly are you going to "just write SQL" if the actual query statement needs to change based on the user input?

How exactly are you going to "just write SQL" if the actual query statement needs to change based on the user input? How about something like this: s = Select.new s.add "WHERE title LIKE #{title}" if title s.add "WHERE price <= #{price_range}" if price_range s.add "LIMIT #{limit}" if limit s.add "OFFSET #{offset}" if offset s.add "id, blah, boo FROM products" s.execute Note how I deliberately shuffled the order and didn't bother with escaping. Also note how anyone who knows SQL could immediately work with this, learning curve: 5 seconds. Why is there no ORM that works like this?

Posted by moe on Mar 10, 2015, 7:46 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.7,500 issues0 comments

pricing (E-commerce)

How exactly are you going to "just write SQL" if the actual query statement needs to change based on the user input?

moeMar 10, 2015, 7:46 PM

How exactly are you going to "just write SQL" if the actual query statement needs to change based on the user input? How about something like this: s = Select.new s.add "WHERE title LIKE #{title}" if title s.add "WHERE price <= #{price_range}" if price_range s.add "LIMIT #{limit}" if limit s.add "OFFSET #{offset}" if offset s.add "id, blah, boo FROM products" s.execute Note how I deliberately shuffled the order and didn't bother with escaping. Also note how anyone who knows SQL could immediately work with this, learning curve: 5 seconds. Why is there no ORM that works like this?

Comments (0)

No comments yet. Start the discussion.

Comment on this issue