[EMAIL PROTECTED] wrote:
I am pretty sure it is something trivial but it does not work for me, can someone please help me figure out what I may be missing.


strcpy( query, "select count(*) from dummy");

rc = sqlite3_prepare( memdb, query, strlen(query), &pStmt, NULL);
if (rc) {
        return;
}
rc = sqlite3_bind_text( pStmt, 1, query, strlen(query), SQLITE_STATIC);
if ( rc) {
return ; }
Mario,

You are confused about the function of sqlite3_bind_*(). They are for input parameters to queries. You are trying to get the output results of a query.

After you prepare your query you need to execute it using sqlite3_step(). This function will return after each result row is located. In your case there is only one result row, the one with the count.

Now for each column in each result row you will need to call one of the sqlite3_column_*() functions to retrieve the value of that column for the current row. Again in your case there will only be one result column (the count), and it is an integer value, so you will use sqlite3_column_int() to get the count value.

If your query returned multiple result rows you would call sqlite3_step again in a loop to get the next result row.

HTH
Dennis Cote

Reply via email to