xref: /netbsd-src/external/public-domain/sqlite/man/sqlite3changeset_new.3 (revision b9988867a8ad969c45a52aa7628bc932ec98d46b)
1.Dd January 24, 2024
2.Dt SQLITE3CHANGESET_NEW 3
3.Os
4.Sh NAME
5.Nm sqlite3changeset_new
6.Nd obtain new.* values from a changeset iterator
7.Sh SYNOPSIS
8.In sqlite3.h
9.Ft int
10.Fo sqlite3changeset_new
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_UPDATE or SQLITE_INSERT.
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
36new row values stored as part of the UPDATE or INSERT change and returns
37SQLITE_OK.
38If the change is an UPDATE and does not include a new value for the
39requested column, *ppValue is set to NULL and SQLITE_OK returned.
40The name of the function comes from the fact that this is similar to
41the "new.*" columns available to update or delete triggers.
42.Pp
43If some other error occurs (e.g. an OOM condition), an SQLite error
44code is returned and *ppValue is set to NULL.
45.Sh IMPLEMENTATION NOTES
46These declarations were extracted from the
47interface documentation at line 11630.
48.Bd -literal
49SQLITE_API int sqlite3changeset_new(
50  sqlite3_changeset_iter *pIter,  /* Changeset iterator */
51  int iVal,                       /* Column number */
52  sqlite3_value **ppValue         /* OUT: New value (or NULL pointer) */
53);
54.Ed
55.Sh SEE ALSO
56.Xr sqlite3changeset_apply 3 ,
57.Xr sqlite3changeset_next 3 ,
58.Xr sqlite3changeset_start 3 ,
59.Xr SQLITE_CREATE_INDEX 3 ,
60.Xr SQLITE_OK 3
61