sqlgg icon indicating copy to clipboard operation
sqlgg copied to clipboard

Raw text / unsafe substitution in queries

Open cyberhuman opened this issue 10 years ago • 2 comments

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

cyberhuman avatar Mar 04 '15 10:03 cyberhuman

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

jongleb avatar Oct 11 '24 07:10 jongleb

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

ygrek avatar Oct 11 '24 15:10 ygrek