ygrek / sqlgg

SQL Guided (code) Generator
https://ygrek.org/p/sqlgg/
GNU General Public License v2.0
62 stars 20 forks source link

Raw text / unsafe substitution in queries #16

Open cyberhuman opened 9 years ago

cyberhuman commented 9 years ago

E.g. I would like to SELECT * FROM table WHERE column IN (item1, item2, ...), where the list on the right of IN is built at run time.

The syntax could be like this:

-- @get_column
SELECT * FROM table WHERE column IN (@1)

And sqlgg would generate code like this:

let get_column_in db ~sqlgg_raw_1 callback =
  ...
  T.select db ("SELECT * FROM table WHERE column IN (" ^ sqlgg_raw_1 ^ ")") set_params invoke_callback
jongleb commented 3 weeks ago

https://github.com/ygrek/sqlgg/commit/c36679d0e35a29caf1c2f0a7bd30ccb8b70741a2

ygrek commented 3 weeks ago

the issue is about arbitrary (unsafe) substitutions (i like the syntax << ... >> now), not just in tuple