i think i understand why it doesnt work for select *..

because sqlite_step executes one row at time.. so after i prepare SELECT * ,
i need to use sqlite_step as many times as table i`m selecting from has rows
(in this case 3 times)..
so i made another function that looks like this:



bool create2 (char * command)

{
sqlite3_stmt * statement2;

if ( sqlite3_prepare (db, command, -1, &statement2, 0) != SQLITE_OK )
        {
                int err = sqlite3_prepare (db, command, -1, &statement2, 0);
                const char * pErr = sqlite3_errmsg (db);
                printf ("\nError %d occured! \n %s", err, pErr  );
                return 1;
        }
int i;
for (i=0; i<=3; i++)
{
        int smth= sqlite3_step (statement2);
        printf ("\n command= %s result code = %d \n",command, smth);
}
        sqlite3_reset (statement2);
        sqlite3_finalize (statement2);

        return 0;
}



and finaly i get SQLITE_DONE but it still doesnt show me table i have
selected...


do i need to use prepare function for each command? if so, isnt then
function select_statement better to use? 


-- 
View this message in context: 
http://old.nabble.com/execute-or-prepare%2Bstep%2Bfinalize-tp26299247p26299743.html
Sent from the SQLite mailing list archive at Nabble.com.

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

Reply via email to