Problem with the new pointer-passing interface

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Problem with the new pointer-passing interface

Ulrich Telle

I came across a problem with the new pointer-passing interface, when I tried
to incorporate the carray extension into my wxSQLite3 wrapper for SQLite3.  

In the comment of the sqlite3_bind_pointer() routine I found this note:  

The T parameter should be a static string, preferably a string literal.  

This comment is a bit misleading, since it doesn't become clear that the
string pointer for T must be valid as long as the associated statement is

In my case this is quite cumbersome, since in my wrapper I have to extract
the value of parameter T from a temporary string object. That is, shortly after
having called sqlite3_bind_pointer the temporary string goes out of scope.
The effect is that later on the function sqlite3_value_pointer usually can't see
the correct type value anymore. Therefore sqlite3_value_pointer returns a
NULL pointer ... and the carray table is empty.  

IMHO it would be better if the function sqlite3_bind_pointer would make a
copy of the type string and would thus be independent of the life span of the
type parameter.  


E-Mail privat:  [hidden email]
World Wide Web:

sqlite-users mailing list
[hidden email]