3 ms·
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
by dharbin 12y ago
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 https://github.com/civitaslearning/swigql
- makmanalp 12y agoMy 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://www.postgresql.org/docs/9.2/static/sql-prepare.html http://dev.mysql.com/doc/refman/5.0/en/sql-syntax-prepared-statements.html http://dev.mysql.com/doc/refman/5.0/en/sql-syntax-prepared-s...
- jimktrains2 12y ago> 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.