xref: /netbsd-src/external/public-domain/sqlite/man/sqlite3changeset_old.3 (revision b9988867a8ad969c45a52aa7628bc932ec98d46b)
1.Dd January 24, 2024
2.Dt SQLITE3CHANGESET_OLD 3
3.Os
4.Sh NAME
5.Nm sqlite3changeset_old
6.Nd obtain old.* values from a changeset iterator
7.Sh SYNOPSIS
8.In sqlite3.h
9.Ft int
10.Fo sqlite3changeset_old
11.Fa "sqlite3_changeset_iter *pIter"
12.Fa "int iVal"
13.Fa "sqlite3_value **ppValue"
14.Fc
15.Sh DESCRIPTION
16The pIter argument passed to this function may either be an iterator
17passed to a conflict-handler by
18.Fn sqlite3changeset_apply ,
19or an iterator created by
20.Fn sqlite3changeset_start .
21In the latter case, the most recent call to
22.Fn sqlite3changeset_next
23must have returned SQLITE_ROW.
24Furthermore, it may only be called if the type of change that the iterator
25currently points to is either SQLITE_DELETE or SQLITE_UPDATE.
26Otherwise, this function returns SQLITE_MISUSE and sets
27*ppValue to NULL.
28.Pp
29Argument iVal must be greater than or equal to 0, and less than the
30number of columns in the table affected by the current change.
31Otherwise, SQLITE_RANGE is returned and *ppValue is set
32to NULL.
33.Pp
34If successful, this function sets *ppValue to point to a protected
35sqlite3_value object containing the iVal'th value from the vector of
36original row values stored as part of the UPDATE or DELETE change and
37returns SQLITE_OK.
38The name of the function comes from the fact that this is similar to
39the "old.*" columns available to update or delete triggers.
40.Pp
41If some other error occurs (e.g. an OOM condition), an SQLite error
42code is returned and *ppValue is set to NULL.
43.Sh IMPLEMENTATION NOTES
44These declarations were extracted from the
45interface documentation at line 11599.
46.Bd -literal
47SQLITE_API int sqlite3changeset_old(
48  sqlite3_changeset_iter *pIter,  /* Changeset iterator */
49  int iVal,                       /* Column number */
50  sqlite3_value **ppValue         /* OUT: Old value (or NULL pointer) */
51);
52.Ed
53.Sh SEE ALSO
54.Xr sqlite3changeset_apply 3 ,
55.Xr sqlite3changeset_next 3 ,
56.Xr sqlite3changeset_start 3 ,
57.Xr SQLITE_CREATE_INDEX 3 ,
58.Xr SQLITE_OK 3
59