-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 07 October 2007 17:39
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Re: Callback fonction really not flexible to use

Igor Tandetnik a écrit :
[EMAIL PROTECTED] wrote:
   Here a sample (in c) of the use i would like to do with sqlite
   fucntion1() call fonction2() where is sqlite3_exec()
   Callback function is the function3() and i would like to add data
   in an array, which is retuned to function1() after the call of
function(2).
   How i can do that ? does the Callback function can return
something else than an int ?
A callback function must return 0. Any non-zero return value is an error indicator.

However, the callback can, and usually does, have side effects. The void* parameter you pass to sqlite3_exec is passed through to the callback. Normally, this points to some kind of a data structure that the callback modifies.


Having said that, be aware that sqlite3_exec is retained for backward compatibility only. It is highly recommended for new code to use API like sqlite3_prepare, sqlite3_step, sqlite3_finalize, sqlite3_column_* to iterate over the resultset. In fact, sqlite3_exec itself is implemented entirely in terms of these public API functions.

Igor Tandetnik


----------------------------------------------------------------------------
-
To unsubscribe, send email to [EMAIL PROTECTED]

----------------------------------------------------------------------------
-




Thanks for your answer,

Is there somewhere an snipet code to read a db in C with "sqlite3_step,
sqlite3_finalize, sqlite3_column_*"
In the official doc, there is only the call to the sqlite3_exec() function.


Mike Marshall a écrit :
Here's something from some code I was working on this morning that hopefully
will help

sqlite3_stmt* pStatement;
char* acQuery = sqlite3_mprintf("SELECT feedurl FROM feeds WHERE pageurl =
'%q'",sUrl.c_str());
int nError = sqlite3_prepare_v2(m_pDB,acQuery,-1,&pStatement,NULL);
while (nError == SQLITE_OK && sqlite3_step(pStatement) == SQLITE_ROW)
{
        string sFeed = (char*)sqlite3_column_text(pStatement,0);
}
sqlite3_finalize(pStatement);
sqlite3_free(acQuery);




Thanks you very much that helped me ! it seem to work fine and thats really 
better than that satanas vade retro calback function.

Fred.



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to