SQLite Forum

sqlite3_carray_bind and constness

sqlite3_carray_bind and constness

(1) By Marco Bubke (marcob) on 2021-07-22 10:29:43 [source]

sqlite3_carray_bind is using a non const pointer which is forcing a copy if you use const data. You can cast to non const but then you are in undefined behavior area. A const version like sqlite3_const_carray_bind could prevent bugs in that erroneous usage. Or is there an other way?

(2) By Larry Brasfield (larrybr) on 2021-07-22 13:39:09 in reply to 1 [link] [source]

Because the virtual table is read-only as seen by its users from SQLite, you could just enforce const correctness in ext/misc/carray.{c,h} . Until the code supports update/insert/delete (by giving the virtual table implementation an xUpdate method), there is no reason that input cannot be treated as const.