kriscbe wrote:
> more clearly
>
> in my c++ program:
>
> int value = sql.exe("select counter form tbl1 where name = 'accept'");
> in this sql.exe is my function which invokes the "sqlite3_exec" function
>
> i want that counter value into the "value" variable .
>
>   
If you use sqlite3_exec, you must specify a pointer to a callback 
function (which must use the same calling convention as sqlite3_exec, 
typically cdecl on Unix-ish operating systems) as the 3rd argument in 
the call to sqlite3_exec. That function is called once for each row of 
the result set and receives pointers to where the retrieved data is 
stored. The function must have this signature:

int my_exec_callback(void* pUserData, int numCols, char** pzValues, 
char** pzColNames)

pUserData gets passed through unmodified from the 4th argument of the 
sqlite3_exec invocation.
numCols holds the number of columns in the result set (i.e., the length 
of the pzValues and pzColNames arrays.)
pzValues points to an array of NUL-terminated UTF-8 strings holding the 
results, in order.
pzColNames points to an array of NUL-terminated UTF-8 strings holding 
the names of each column from the result set, in order.

For more details, see http://sqlite.org/c3ref/exec.html

In your case, you will need to place "value" outside of the function 
scope, to where your callback can safely access it.

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

Reply via email to