> 2. In between with another statement handle if I update the table, here I
> am updating the record which is just fetches by my cursor mentioned in
> step 1.

You shouldn't do that. It's a bad idea in general and it leads to
undefined results in SQLite specifically.

> - Ultimately, its fetching dirty record, though the default isolation
> level is SERIALIZABLE.

Isolation level is isolation between transactions. There's no
isolation between statements inside the same transaction.

> - Is it something, I am doing wrong here ? What is it related to DESC sort
> order only ? Is there any way / flag to block this behavior

You can avoid this behavior by avoiding ill-formed pattern: do not
change table while there's an open cursor on it. You can store
separately what you need to change while fetching rows from cursor.
Then when cursor is closed you can do all your changes. Alternatively
you can do all updates in a separate connection and thus in a separate
transaction. But it will work only in WAL journal mode in SQLite
3.7.2.


Pavel

On Wed, Oct 6, 2010 at 10:45 AM, Abhijeet Shiral
<abhijeet_shi...@magicsoftware.com> wrote:
> Following is the scenario
> 1. I have a cursor open for the table and records are being fetched. Here
> are the steps.
> - Prepare the statements
> - Perform sqlite3_step ( ).
> 2. In between with another statement handle if I update the table, here I
> am updating the record which is just fetches by my cursor mentioned in
> step 1.
> 3. In this case, if I perform sqlite3_step() with first cursor (mentioned
> in point 1), instead of fetching second / another record in the list, it
> re-fetches the same record again with updated values.
>
> - This is the problem when I am updating the field of the table which is
> segment of one of the indexes.
> - And when first cursor is opened with DESC order by clause, with the
> index not having segment as, the field which I am updating.
>
> - Ultimately, its fetching dirty record, though the default isolation
> level is SERIALIZABLE.
> - Is it something, I am doing wrong here ? What is it related to DESC sort
> order only ? Is there any way / flag to block this behavior
>
> Thanks & Regards
> Abhijeet
> _______________________________________________
> 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

Reply via email to