On Tue, 17 Dec 2013 20:43:02 GMT, Luís Marques wrote:
I have ddb working, but I don't know how to pass parameters to queries (without concatenating strings, which is unsafe and awkward). That is, I'm looking for something like this:
PGCommand(conn, "SELECT * FROM foo WHERE bar = ?", barValue);
I had missed the right part of the source (I couldn't get dmd -D to work for postgres.d) where it says:
Examples:
---
// without spaces between $ and number
auto cmd = new PGCommand(conn, "INSERT INTO users (name, surname) VALUES ($ 1, $ 2)");
cmd.parameters.add(1, PGType.TEXT).value = "John";
cmd.parameters.add(2, PGType.TEXT).value = "Doe";
I had expected that one could pass the params directly in the ctor, like in my example.