News for hackers. Stuff that matters.
Re:What ORMs have taught me: just learn SQL by dharbin on Monday August 04, 2014 @05:51PM (#8134259)
Take a look at my library, swigql[1]. You can create a base query and then extend that query however you want via template inheritance.

[1] https://github.com/civitaslearning/swigql

Re:What ORMs have taught me: just learn SQL by makmanalp on Monday August 04, 2014 @06:06PM (#8134331)
My personal opinion on such libraries is that they're cool, and I think they do make life easier but they're just a more advanced form of string concatenation. No notion of SQL types, syntax or structure. To follow the template analogy, a low level abstraction library allows me to not only change the variables but also change the template programmatically. And not by concatenating more stuff onto the template either :P

Prepared statements, by contrast, are also a form of string concatenation. And they have some understanding of type and syntax, but only because they learn them from the server:

http://www.postgresql.org/docs/9.2/static/sql-prepare.html

http://dev.mysql.com/doc/refman/5.0/en/sql-syntax-prepared-s...

Re:What ORMs have taught me: just learn SQL by jimktrains2 on Tuesday August 05, 2014 @08:53AM (#8136627)
> Prepared statements, by contrast, are also a form of string concatenation. And they have some understanding of type and syntax, but only because they learn them from the server:

Prepared statements are NOT string concatenation. The server parses the SQL, creates what internal representation it does, and then uses the parameters more as arguments to that executable statement than checks them and sticks them in. At no point does a SQL statement exist with the parameters and SQL.