bind package:direct-sqlite

Convenience function for binding values to all parameters. This will fail if the list has the wrong number of parameters.
Convenience function for binding named values to all parameters. This will fail if the list has the wrong number of parameters or if an unknown name is used. Example:
stmt <- prepare conn "SELECT :foo + :bar"
bindNamed stmt [(":foo", SQLInteger 1), (":bar", SQLInteger 2)]
https://www.sqlite.org/c3ref/bind_parameter_count.html This returns the index of the largest (rightmost) parameter. Note that this is not necessarily the number of parameters. If numbered parameters like ?5 are used, there may be gaps in the list. See ParamIndex for more information.
https://www.sqlite.org/c3ref/bind_parameter_name.html Return the N-th SQL parameter name. Named parameters are returned as-is. E.g. ":v" is returned as Just ":v". Unnamed parameters, however, are converted to Nothing. Note that the parameter index starts at 1, not 0.
If the index is not between 1 and bindParameterCount inclusive, this fails with ErrorRange. Otherwise, it succeeds, even if the query skips this index by using numbered parameters. Example:
> stmt <- prepare conn "SELECT ?1, ?3, ?5"
> bindSQLData stmt 1 (SQLInteger 1)
> bindSQLData stmt 2 (SQLInteger 2)
> bindSQLData stmt 6 (SQLInteger 6)
*** Exception: SQLite3 returned ErrorRange while attempting to perform bind int64.
> step stmt >> columns stmt
[SQLInteger 1,SQLNull,SQLNull]
https://www.sqlite.org/c3ref/clear_bindings.html Set all parameters in the prepared statement to null.