"Stephen Woodbridge" <[EMAIL PROTECTED]>
wrote in message news:[EMAIL PROTECTED]
> Igor Tandetnik wrote:
>> "Nikolaus Rath" <[EMAIL PROTECTED]> wrote in
>> message news:[EMAIL PROTECTED]
>>> What happens if
>>>
>>> 1. I prepare and execute a select statement
>>> 2. I retrieve a couple of rows
>>> 3. I execute a new query that would change the result of the
>>>    query in 1
>>
>> On the same connection, I assume.
>>
>>> 4. I continue to retrieve the results of 1)
>>>
>>> Will I get the results as if step 3 hasn't happened, is the result
>>> undefined, or will my result set somehow be updated?
>>
>> You may or may not see the changes introduced by step 3. E.g. if
>> step 3 updates a record that you've already visited, you naturally
>> won't visit it again and thus won't see the changes. But if it
>> updates a record you haven't visited yet, when you get to it you
>> will see the new data.
>
> Hmmm, that does not seem right, but what do I know. The reason I say
> this is because if the update change a column value on a record the
> would cause it to ne not selected or it changes some other that had
> not been selected before but would be after the change I'm not sure
> how these would magically get included or excluded.

SQLite doesn't prepare the whole resultset up front, but retrieves 
records on demand - one record for every sqlite3_step call. If the 
record matches the conditions by the time the statement gets to it, it 
will be returned. If not, it will be skipped.

> I assume the when you make a query your results on in a set of data
> the is private to your session/connection and that other transactions
> on the database can not change you private data.

... but the same connection within the same transaction can.

Igor Tandetnik



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

Reply via email to