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