Arbol One <arbol...@gmail.com> wrote:
> Since the call to the sqlite3_step function is inside the mySQLite3::read_*
> class-function/method

... it is clear that you have a poor class design. As you would generally want 
to read several columns from the same row, it is unwise to have a read_* method 
call sqlite3_step, thus advancing to the next row. It is even less wise to have 
it call sqlite3_prepare and sqlite3_finalize.

> Now, in a while loop inside
> Runner::read_tblName() I could call the mySQLite3::read_* for the data to be
> retrieved, but instead of reading the next row of data, it keeps on reading
> the same row again and again.

Because you prepare and finalize the stament again and again. Think about it 
this way: sqlite3_prepare call opens a book, sqlite3_step call turns a page, 
sqlite3_finalize call closes the book shut. Your read_* method opens the book, 
turns to the first page, reads one line, then closes the book. The next read_* 
call opens the book again, turns to the first page again, reads another line, 
and closes the book. Again, and again.

Is it still surprising that you never progress past the first page?

> Obviously my problem is in design

Indeed.

> but I don't have enough experience using SQLite3 to come up with a better 
> idea.

In this case, perhaps you should consider using, or at least studying, some 
existing libraries. There's no shortage of them:

http://www.sqlite.org/cvstrac/wiki?p=SqliteWrappers

-- 
Igor Tandetnik

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

Reply via email to