SQLite Forum

Prepared Statements
Login
I have a number of lengthy queries stored in a table by a unique name. <i>(This removes verbosity/clutter from the calling application)</i>

At runtime, an application requests the execution of a particular statement by name. For this I use the sequence

```
sqlite3_open
       sqlite3_prepare_v2
       sqlite3_step
       sqlite3_finalize
sqlite3_close       
```

A given query may or may not require parameters specified at runtime.

1. Is there an API to be called after sqlite_prepare_v2 that indicates  whether I should use the sqlite3_bind_* APIs <i><u>before</u></i> calling sqlite3_step? 
2. And, how many parameters I should expect?

and finally,

3. Is it possible to save a prepared statement and (may be) use it with sqlite3_exec?

<i>(As a workaround, I know that I can add more columns to the table to indicate whether parameters are  required with 0 = none required, n = n parameters required).</i>

<sup>Aask</sup>