On Thu, Dec 6, 2018 at 11:10 AM Hick Gunter <h...@scigames.at> wrote:
> Maybe someone can come up with a CTE that works for this... > How so? I'm not following you. Ryan already provided a CTE to transform a string into values, but that involves string parsing, and is kinda ugly (no offence Ryan :) ), and unlikely to be that efficient relative to carray. The point is that binding is *scalar only* in SQLite. If OTOH, we could write: ...prepare...(db, "select ... from t where c in (?)", ..., &stmt, ...); ...bind_array(stmt, 1, SQLITE_INTEGER, vec.size()); for (auto elem : vec) { ...bind_int(stmt, 1, elem); } ...bind_array would instantiate the same array the carray() extension supports. Existing typed bind APIs would fill in that array, with usual SQLite conversions, error checking against declared array-type. And ...prepare would transparently transform WHERE c IN (?) with WHERE c IN (carray(?)) with the internally managed C array. Of course, at prepare time, SQLite doesn't know yet ? is not a scalar as usual, so perhaps a different notation is necessary, like the TABLE() operator in Oracle SQL for example. But given carray() and the existing infrastructure, I naively fail to see how the above wouldn't work. My $0.02. --DD [1] https://www.sqlite.org/c3ref/c_blob.html _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users