"Severin Müller" <[EMAIL PROTECTED]> wrote:
> Hi Folks
>
> I have the following C funtion:
>
> void get_acc(char *src,int ac,char **av)
> {
>        char *buf = "SELECT accmask FROM testtable;");
> sqlite3 *db;
> struct sqlite3_stmt *oStmt;
>         int rc;
> if(sqlite3_prepare_v2(db,buf,strlen(buf),&oStmt,NULL)==SQLITE_OK)

You are using uninitialized db variable. You need to open the database 
connection first with sqlite3_open.

> {
> while(sqlite3_step(oStmt)==SQLITE_ROW)
> {
> sqlite3_step(oStmt);

You call sqlite3_step twice on every iteration. Which means you only 
look at every other row.

> txt = (char*)sqlite3_column_text(oStmt,0);

txt is never declared.

> sqlite3_reset(oStmt);
> sqlite3_finalize(oStmt);
>                         sqlite3_close(db);

You finalize the statement and close the databse after reading just one 
row. Don't you want to enumerate all rows?

Igor Tandetnik 



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

Reply via email to