Parameters array in database and content blocks

25 views
Skip to first unread message

Shari Shark

unread,
Oct 3, 2022, 9:06:55 AM10/3/22
to automa...@googlegroups.com
I'm using content query block and the sql I'm using is an in list. As an example, select * from table where id in (..., ..., ...).

The number of items in the list is dynamic and not fixed. I'm trying to use the parameters to pass in an array but the syntax is wrong.

My syntax is "id in (?)" and the parameters is an array with multiple integers. How should I get this to work?

Henrik "The Developer" Lindqvist

unread,
Oct 3, 2022, 9:27:06 AM10/3/22
to Automate
An ? parameter only works for a single value, not a list of values (in) nor an array of values, since SQLite doesn't support either.
When using the "in" statement you'll have to generate the whole SQL statement, e.g. select * from table where id in ({arrayOfIntegers;join;,}), beware of SQL injection attacks.
Reply all
Reply to author
Forward
0 new messages