wcl...@gfs-hofheim.de wrote:
> What I would really like to be able to do would be to cache objects
> returned by sqlite3_column_value(...) and process them later, even after
> the statement that generated them is finalised

You can't. The only thing you can reliably do with the result of 
sqlite3_column_value is to pass it to sqlite3_bind_value or 
sqlite3_result_value. Further, that sqlite_value pointer is only valid while 
the statement is live and positioned at the same row: any call to sqlite3_step, 
sqlite3_reset or sqlite3_finalize invalidates it.

You will have to call sqlite3_column_type, then the appropriate 
sqlite3_column_*. If the type is string or blob, you would also need to make a 
copy of the actual data if you want it available for later processing.

> I realise that I could cache them in their final form (e.g. as integer,
> string, whatever in some form of union or struct), but at the point the
> statement runs and the row is being read, it may not be fully determined
> what form the output might be -- e.g. in the database it might be stored
> as integer, but required as float or string, etc. and for this to be known
> much later.  Since sqlite provides such a useful means of "converting"
> types through the sqlite_value* functions, I would really like to be able
> to use these.

Well, too bad.

> Looking through the documentation, I can't seem to find an api function
> that converts "unprotected" value to objects to "protected" ones.

"Protected" means "a mutex is held while the value is outstanding". If such a 
hypothetical API existed, it would mean you could instruct SQLite to hold a 
mutex for an indefinite period of time, thus blocking all other activity on the 
connection. I doubt you actually want that.

Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to