Igor, you didn't read ArbolOne's incomprehensible code correctly.  Here it is 
with reasonable formatting:



void mySQLite3::setStmt(const Glib::ustring& s)

{

                SQLStatement = s;

                if (mystmt == NULL)

                {

                                rc = sqlite3_prepare_v2(db, 
SQLStatement.c_str(), -1, &mystmt,NULL);

                }

                if(rc != SQLITE_OK)

                {

                                ...

                }

                rc = sqlite3_step(mystmt);

}



const int mySQLite3::read_int(int pos)

{

   if(rc == SQLITE_ROW )

   {

                   apint = sqlite3_column_int(mystmt,pos);

   }

   return apint;

}



const Glib::ustring& mySQLite3::read_str(const int pos)

{

   if(rc == SQLITE_ROW )

   {

                   apstr = (const char*)sqlite3_column_text(mystmt,pos);

   }

   return apstr;

}





You don't show where these functions are being called, but you are doing one of 
two things.  You are calling setStmt inside a loop, in which case you are 
rebuilding the statement every time and then reading the first row each time 
(completely ignoring Igor's message about opening a book, reading the first 
page, closing the book, repeating that entire sequence, and wondering why you 
never finish the book), or you are calling setStmt once, in which case you open 
the book, read the first page, close the book, and wonder why you never finish 
the book.



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

Reply via email to