SQLite Forum

sqlite3_exec: the 3rd argument
Login
> The callback function is executed as many times as there are rowsin the result. Correct?

Yes.

 > The callback function returns the column names every time it is called? Correct?

Yes.

 > If affirmative, isn't this superfluous?

No.

 > How does the callback function handle the different types in the result columns? (Int, Float etc)?

It does not.  All values are converted to text strings.  This interface is designed for "primitive applications"

 > My callback function consistently fails on the second call: any ideas on how to overcome this? (I'm using C#)

Are you attempting to "hang onto a pointer" after your callback returns?  You cannot do this.  The pointer arrays received for the data and colnames are only valid for the duration of the execution of the callback.  They are invalid once you return from the callback function.  If you want to access the data after the callback is complete or after sqlite3_exec is complete, you need to copy it somewhere else that you control.  The same thing applies to the contents of the array of pointers and the data itself.  You should not be attempting to modify that which you do not own.