Thank you very much!

this is my first time to use sqlite3. using prepared statements is a little
difficult. Could I avert to another way(more simple way) to achieve the same
thing?

Or where could I get some example codes on the method of using prepared
statements?


Igor Tandetnik wrote:
> 
> "liubin liu" <[email protected]> wrote in message
> news:[email protected]
>> the question is on the callback function's return values of
>> sqlite3_exec()
>>
>> when using sqlite3_exec() to do "select * from ...", how to get all
>> the return values by using the callback function?
>>
>> it could print the result, but couldn't return the values. If do like
>> so, just one value could be get.
>> how to get all the values?
> 
> Memory allocated for value[] strings is valid only inside the callback. 
> It is deallocated or reused as soon as the callback returns. So, you 
> can't just store a pointer you receive - it'll soon become invalid. You 
> need to allocate your own memory and make a copy of string contents.
> 
> Also, consider using prepared statements instead of sqlite3_exec - see 
> sqlite3_prepare, sqlite3_step, sqlite3_finalize, sqlite3_column_*. For 
> one thing, values of numeric fields could be retrieved directly as 
> integers, rather than converted to strings and then converted back.
> 
> Igor Tandetnik
> 
> 
> 
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

-- 
View this message in context: 
http://www.nabble.com/a-question-on-the-callback-function%27s-return-values-of-sqlite3_exec%28%29-tp22176984p22194312.html
Sent from the SQLite mailing list archive at Nabble.com.

_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to