On Mar 31, 2011, at 9:30 AM, john darnell wrote: > BTW, if there is a better way to get a row count without using > sqlite3_get_table() that would also work.
maybe I am missing something, but what is wrong with "SELECT Count(*) FROM table"? > > _____________________________________________ > From: john darnell > Sent: Thursday, March 31, 2011 9:27 AM > To: 'General Discussion of SQLite Database' > Subject: using sqlite3_get_table > > > > All I need to do is see how many rows a table has. I stumbled across this > function and used it thusly in my code (I removed the error checking for the > sake of brevity): > > Result = sqlite3_initialize(); > > sqlite3 *db_ptr; > Result = 0; > > Result = sqlite3_open_v2(DBEnginePath, &db_ptr, SQLITE_OPEN_READWRITE, > NULL); > > char ***CArray = NULL; > int iRow, iCol; > char **err = NULL; > sqlite3_get_table(db_ptr, "Select * from Admin", CArray, &iRow, &iCol, err); > > Unfortunately, when I execute the sqlite_get_table call, I get an error > message telling me that I have an "unhandled error." It says that the error > is occurring here: > > struct unixShm { > unixShmNode *pShmNode; /* The underlying unixShmNode object */ > unixShm *pNext; /* Next unixShm with the same unixShmNode */ > u8 hasMutex; /* True if holding the unixShmNode mutex */ > u16 sharedMask; /* Mask of shared locks held */ > u16 exclMask; /* Mask of exclusive locks held */ > #ifdef SQLITE_DEBUG > u8 id; /* Id of this connection within its unixShmNode */ > #endif > > I am QUITE CERTAIN that my problem lies with the way I am declaring the > arrays, but not having an example to teach me, I have no idea what the > correct method is. If anyone has an example of how he or she is using > sqlite3_get_table that he or she wouldn't mind sharing, I would be > appreciative. > > TIA! > > R, > John A.M. Darnell > Senior Programmer > Walsworth Publishing Company > Brookfield, MO > John may also be reached at > johnamdarn...@gmail.com<mailto:johnamdarn...@gmail.com> > > Trivia question: Who saved Gandalf from his imprisonment at the Tower of > Isengard in book 1 of The Lord of the Rings (i.e. The Fellowship of the Ring)? > > > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users