1.Dd December 19, 2018 2.Dt SQLITE3CHANGESET_INVERT 3 3.Os 4.Sh NAME 5.Nm sqlite3changeset_invert 6.Nd Invert A Changeset 7.Sh SYNOPSIS 8.Ft int 9.Fo sqlite3changeset_invert 10.Fa "int nIn" 11.Fa "const void *pIn" 12.Fa "int *pnOut" 13.Fa "void **ppOut " 14.Fc 15.Sh DESCRIPTION 16This function is used to "invert" a changeset object. 17Applying an inverted changeset to a database reverses the effects of 18applying the uninverted changeset. 19Specifically: 20.Bl -bullet 21.It 22Each DELETE change is changed to an INSERT, and 23.It 24Each INSERT change is changed to a DELETE, and 25.It 26For each UPDATE change, the old.* and new.* values are exchanged. 27.El 28.Pp 29This function does not change the order in which changes appear within 30the changeset. 31It merely reverses the sense of each individual change. 32.Pp 33If successful, a pointer to a buffer containing the inverted changeset 34is stored in *ppOut, the size of the same buffer is stored in *pnOut, 35and SQLITE_OK is returned. 36If an error occurs, both *pnOut and *ppOut are zeroed and an SQLite 37error code returned. 38.Pp 39It is the responsibility of the caller to eventually call sqlite3_free() 40on the *ppOut pointer to free the buffer allocation following a successful 41call to this function. 42.Pp 43WARNING/TODO: This function currently assumes that the input is a valid 44changeset. 45If it is not, the results are undefined. 46