On 6 May 2016, at 1:51pm, Richard Hipp <drh at sqlite.org> wrote:

> I bungled the copy/paste of that URL.  Should be
> https://www.sqlite.org/draft/sessionintro.html

That's very interesting.  I note that

<https://www.sqlite.org/draft/session/sqlite3changeset_invert.html>

says "This function does not change the order in which changes appear within 
the changeset. It merely reverses the sense of each individual change.".

This will not be useful to anyone trying to undo a set of changes to one row.

CREATE TABLE testTable (theText TEXT)
INSERT INTO testTable VALUES ('A')
-- session starts here
UPDATE textTable SET theText='B'        -- changes A to B
UPDATE textTable SET theText='C'        -- changes B to C
-- session ends here

Inverting that without reversing the order will yield

-- changes B to A (documentation suggest that this might be ignored ?)
-- changes C to B

The result would be to leave the value at B, which was true neither at the 
beginning nor end of the session.

Are we meant to iterate backwards through the inverted changeset ?  I don't see 
a way to do it.

Simon.

Reply via email to