On 6/30/2013 10:27 PM, Igor Korot wrote:
1. I'm trying to minimize the number of requests I'm doing to the DB. What
I need is a way to count the number of rows that the query return to me
prior to going thru the "sqlite3_step()".
If this number is 0, I want to skip the processing and just return.

How is this different from just calling sqlite3_step, seeing it return SQLITE_DONE right away, and getting out of the loop?

//////// check the number of rows returned by the query
if( numRows == 0 )
      return;
else
{
sqlite3_step( stmt );
sqlite3_finalize( stmt );
}

This leaks a statement handle. Make it

if (sqlite_step(stmt) == SQLITE_ROW) {
  // Process the row
}
sqlite3_finalize( stmt );

Is there such a function?

No there is not.

2. Considering the same code above, if I want to delete this row, I will
need another statement variable. But will it screw up the original select
statement? Something like this:

Just run this statement;

DELETE FROM players WHERE players.isnew="1";

You are making it way too complicated.
--
Igor Tandetnik

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

Reply via email to