开发者

sqlite step back

开发者 https://www.devze.com 2023-03-27 11:14 出处:网络
I found that the common way for scrolling forwa开发者_如何学编程rd through a result set is using sqlite3_step():

I found that the common way for scrolling forwa开发者_如何学编程rd through a result set is using sqlite3_step():

while (sqlite3_step(statement) == SQLITE_ROW) {
    // do something with the row
}

Is there a way to scroll backwards the result set, like going one step back or accessing a previous row using its ROWID?

Somewhere I have read that you can retrieve each record of the result set by its ROWID, but I can't figure out how.

If there is no such way for retrieving arbitrary rows in the result set, I will like to know whether it would be a bad practice or just a technologic limitation the reason for it.


So I was going through the functions in the sqlite3 framework since I couldn't find any documentation online and found this:

sqlite3_reset(statement)

I didn't test, but since it takes a sqlite3_stmt just like sqlite3_step() does I assume it rewinds the result set back to the beginning.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号