Is it possible, using the Google Cloud Spanner Java SDK, to bind to the parameters supplied to the IN portion of a query?
e.g.
List<String> names = new ArrayList<String>();
names.add("Alice");
names.add("Bob");
String sql = "SELECT * FROM people WHERE name IN (@names)";
Statement statement = Statement
.newBuilder(sql)
.bind("names").to(names)
.build();
If we bind names using toStringArray, it errors. And if we set the following:
names = "'Alice','Bob'";
Then the generated SQL is:
SELECT * FROM people WHERE name IN ("'Alice','Bob'")
- Note the extra quotations. Any idea how we can do this without %s string substitution to avoid inject attacks?