On 7/6/10, Andrew Wood <ajw...@theiet.org> wrote: > Whats the procedure for using sqlite3_step? > > I thought it would be along the lines of the following, but the while > loop executes infinately. I would have expected the while loop to run > once for each row found? > > Code is as follows: > > int queryreturn = sqlite3_step(preparedstatement); > > if (queryreturn == SQLITE_DONE) > { > //no rows found > return; > > } > else if (queryreturn == SQLITE_ROW) > { > //row found, will process in a sec > } > else > { > //error, throw exception > > } > //if we get here we have 1 or more rows to process > > while (queryreturn==SQLITE_ROW) > { //process row > printf("row found\n"); > > //advance to next row > int queryreturn = sqlite3_step(preparedstatement); ^^^
I haven't tried it, but I suspect this is your problem. It looks like you're declaring a new 'queryreturn' int, but the while loop is checking against the one from the top of the program. You can probably just remove the 'int' here. -Mike _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users