Just a note that in PG'OCaml (an OCaml interface to PostgreSQL), you can write:
"insert into foo (col1,col2,col3) values ($a, $b, $c)"
and it creates the safe prepared statement with ? placeholders. At compile time. Type-checked against the database to make sure your program types match your column types.
I would be very careful with such SQL statements. I am guessing it relies on some intrinsic fields' order? That could change anytime. Order of fields shouldn't have any impact on you app, but I think in your case it does.
Comments
Just a note that in PG'OCaml (an OCaml interface to PostgreSQL), you can write:
and it creates the safe prepared statement with ? placeholders. At compile time. Type-checked against the database to make sure your program types match your column types.http://pgocaml.forge.ocamlcore.org/
I would be very careful with such SQL statements. I am guessing it relies on some intrinsic fields' order? That could change anytime. Order of fields shouldn't have any impact on you app, but I think in your case it does.
The "..." wasn't literal. I have amended the post to make this clear.