xref: /netbsd-src/external/public-domain/sqlite/man/SQLITE_CHANGESET_DATA.3 (revision b9988867a8ad969c45a52aa7628bc932ec98d46b)
1.Dd January 24, 2024
2.Dt SQLITE_CHANGESET_DATA 3
3.Os
4.Sh NAME
5.Nm SQLITE_CHANGESET_DATA ,
6.Nm SQLITE_CHANGESET_NOTFOUND ,
7.Nm SQLITE_CHANGESET_CONFLICT ,
8.Nm SQLITE_CHANGESET_CONSTRAINT ,
9.Nm SQLITE_CHANGESET_FOREIGN_KEY
10.Nd constants passed to the conflict handler
11.Sh SYNOPSIS
12.In sqlite3.h
13.Fd #define SQLITE_CHANGESET_DATA
14.Fd #define SQLITE_CHANGESET_NOTFOUND
15.Fd #define SQLITE_CHANGESET_CONFLICT
16.Fd #define SQLITE_CHANGESET_CONSTRAINT
17.Fd #define SQLITE_CHANGESET_FOREIGN_KEY
18.Sh DESCRIPTION
19Values that may be passed as the second argument to a conflict-handler.
20.Bl -tag -width Ds
21.It SQLITE_CHANGESET_DATA
22The conflict handler is invoked with CHANGESET_DATA as the second argument
23when processing a DELETE or UPDATE change if a row with the required
24PRIMARY KEY fields is present in the database, but one or more other
25(non primary-key) fields modified by the update do not contain the
26expected "before" values.
27.Pp
28The conflicting row, in this case, is the database row with the matching
29primary key.
30.It SQLITE_CHANGESET_NOTFOUND
31The conflict handler is invoked with CHANGESET_NOTFOUND as the second
32argument when processing a DELETE or UPDATE change if a row with the
33required PRIMARY KEY fields is not present in the database.
34.Pp
35There is no conflicting row in this case.
36The results of invoking the sqlite3changeset_conflict() API are undefined.
37.It SQLITE_CHANGESET_CONFLICT
38CHANGESET_CONFLICT is passed as the second argument to the conflict
39handler while processing an INSERT change if the operation would result
40in duplicate primary key values.
41.Pp
42The conflicting row in this case is the database row with the matching
43primary key.
44.It SQLITE_CHANGESET_FOREIGN_KEY
45If foreign key handling is enabled, and applying a changeset leaves
46the database in a state containing foreign key violations, the conflict
47handler is invoked with CHANGESET_FOREIGN_KEY as the second argument
48exactly once before the changeset is committed.
49If the conflict handler returns CHANGESET_OMIT, the changes, including
50those that caused the foreign key constraint violation, are committed.
51Or, if it returns CHANGESET_ABORT, the changeset is rolled back.
52.Pp
53No current or conflicting row information is provided.
54The only function it is possible to call on the supplied sqlite3_changeset_iter
55handle is sqlite3changeset_fk_conflicts().
56.It SQLITE_CHANGESET_CONSTRAINT
57If any other constraint violation occurs while applying a change (i.e.
58a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is invoked
59with CHANGESET_CONSTRAINT as the second argument.
60.Pp
61There is no conflicting row in this case.
62The results of invoking the sqlite3changeset_conflict() API are undefined.
63.El
64.Pp
65.Sh IMPLEMENTATION NOTES
66These declarations were extracted from the
67interface documentation at line 12256.
68.Bd -literal
69#define SQLITE_CHANGESET_DATA        1
70#define SQLITE_CHANGESET_NOTFOUND    2
71#define SQLITE_CHANGESET_CONFLICT    3
72#define SQLITE_CHANGESET_CONSTRAINT  4
73#define SQLITE_CHANGESET_FOREIGN_KEY 5
74.Ed
75