xref: /netbsd-src/external/public-domain/sqlite/man/sqlite3changeset_op.3 (revision b9988867a8ad969c45a52aa7628bc932ec98d46b)
1.Dd January 24, 2024
2.Dt SQLITE3CHANGESET_OP 3
3.Os
4.Sh NAME
5.Nm sqlite3changeset_op
6.Nd obtain the current operation from a changeset iterator
7.Sh SYNOPSIS
8.In sqlite3.h
9.Ft int
10.Fo sqlite3changeset_op
11.Fa "sqlite3_changeset_iter *pIter"
12.Fa "const char **pzTab"
13.Fa "int *pnCol"
14.Fa "int *pOp"
15.Fa "int *pbIndirect"
16.Fc
17.Sh DESCRIPTION
18The pIter argument passed to this function may either be an iterator
19passed to a conflict-handler by
20.Fn sqlite3changeset_apply ,
21or an iterator created by
22.Fn sqlite3changeset_start .
23In the latter case, the most recent call to
24.Fn sqlite3changeset_next
25must have returned SQLITE_ROW.
26If this is not the case, this function returns SQLITE_MISUSE.
27.Pp
28Arguments pOp, pnCol and pzTab may not be NULL.
29Upon return, three outputs are set through these pointers:
30.Pp
31*pOp is set to one of SQLITE_INSERT, SQLITE_DELETE
32or SQLITE_UPDATE, depending on the type of change that
33the iterator currently points to;
34.Pp
35*pnCol is set to the number of columns in the table affected by the
36change; and
37.Pp
38*pzTab is set to point to a nul-terminated utf-8 encoded string containing
39the name of the table affected by the current change.
40The buffer remains valid until either sqlite3changeset_next() is called
41on the iterator or until the conflict-handler function returns.
42.Pp
43If pbIndirect is not NULL, then *pbIndirect is set to true (1) if the
44change is an indirect change, or false (0) otherwise.
45See the documentation for
46.Fn sqlite3session_indirect
47for a description of direct and indirect changes.
48.Pp
49If no error occurs, SQLITE_OK is returned.
50If an error does occur, an SQLite error code is returned.
51The values of the output variables may not be trusted in this case.
52.Sh IMPLEMENTATION NOTES
53These declarations were extracted from the
54interface documentation at line 11527.
55.Bd -literal
56SQLITE_API int sqlite3changeset_op(
57  sqlite3_changeset_iter *pIter,  /* Iterator object */
58  const char **pzTab,             /* OUT: Pointer to table name */
59  int *pnCol,                     /* OUT: Number of columns in table */
60  int *pOp,                       /* OUT: SQLITE_INSERT, DELETE or UPDATE */
61  int *pbIndirect                 /* OUT: True for an 'indirect' change */
62);
63.Ed
64.Sh SEE ALSO
65.Xr sqlite3changeset_apply 3 ,
66.Xr sqlite3changeset_next 3 ,
67.Xr sqlite3changeset_start 3 ,
68.Xr sqlite3session_indirect 3 ,
69.Xr SQLITE_CREATE_INDEX 3 ,
70.Xr SQLITE_OK 3
71