Re: [sqlite] Determining valid statement placeholders.

2019-07-22 Thread Clemens Ladisch
test user wrote: > I want my library to be able to detect the problem programatically. > > I think SQLite internally knows how many placeholders are in the query at > parse time. > > My question is how can I get the data via the API At the moment, there is no such mechanism in the API. You could

Re: [sqlite] Determining valid statement placeholders.

2019-07-21 Thread Simon Slavin
On 21 Jul 2019, at 8:03pm, test user wrote: > For example: "?, ?10" would have two valid indexes: (1, 10). Please don't use numbers as names. That would be extremely confusing to anyone trying to understand your code. > But how can I know that indexes 2-9 are invalid from the API? You have

Re: [sqlite] Determining valid statement placeholders.

2019-07-21 Thread Simon Slavin
On 21 Jul 2019, at 8:03pm, test user wrote: > Is there a `sqlite3` C FFI API that allows me to determine which index values > are valid to bind to? I think you're talking about one of these two: int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName); const char

[sqlite] Determining valid statement placeholders.

2019-07-21 Thread test user
Is there a `sqlite3` C FFI API that allows me to determine which index values are valid to bind to? The `sqlite3_bind_parameter_*` APIs (count, name, index) do not actually provide the valid indexes. For example: "?, ?10" would have two valid indexes: (1, 10). But how can I know that indexes