HI all,
    I want to get the total rows of a table, here are my methods:

     1、  int total_row;
            sqlite3_prepare(db,"select count(ColName) from
tablename",-1,&stmt,0);
            sqlite3_step(stmt);
            total_row = sqlite3_column_int(stmt, 0);
    2、 sqlite3_gettable((db, "select * from tablename", &Result, &nRow,
&nColumn, &zErrMsg);
      I can get the total rows of a table with this tow way,  but the time
use does not meet the requirement.
  Test in my  embedded Linux on Coldfire MCF5407 with a table of 30000
records, It spends about 50ms to get the rownum with first way, and the
second way is more poor.
     Is there some more efficient methods or API interface with
Sqlite?Because my program invoke this interface very frequency.

            Thanks very much!

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

Reply via email to