xref: /netbsd-src/external/public-domain/sqlite/man/SQLITE_CHANGESET_DATA.3 (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1.Dd March 11, 2017
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.Fd #define SQLITE_CHANGESET_DATA
13.Fd #define SQLITE_CHANGESET_NOTFOUND
14.Fd #define SQLITE_CHANGESET_CONFLICT
15.Fd #define SQLITE_CHANGESET_CONSTRAINT
16.Fd #define SQLITE_CHANGESET_FOREIGN_KEY
17.Sh DESCRIPTION
18Values that may be passed as the second argument to a conflict-handler.
19.Bl -tag -width Ds
20.It SQLITE_CHANGESET_DATAThe conflict handler is invoked with CHANGESET_DATA
21as the second argument when processing a DELETE or UPDATE change if
22a row with the required PRIMARY KEY fields is present in the database,
23but one or more other (non primary-key) fields modified by the update
24do not contain the expected "before" values.
25.Pp
26The conflicting row, in this case, is the database row with the matching
27primary key.
28.It SQLITE_CHANGESET_NOTFOUNDThe conflict handler is invoked with CHANGESET_NOTFOUND
29as the second argument when processing a DELETE or UPDATE change if
30a row with the required PRIMARY KEY fields is not present in the database.
31.Pp
32There is no conflicting row in this case.
33The results of invoking the sqlite3changeset_conflict() API are undefined.
34.It SQLITE_CHANGESET_CONFLICTCHANGESET_CONFLICT is passed as the second
35argument to the conflict handler while processing an INSERT change
36if the operation would result in duplicate primary key values.
37.Pp
38The conflicting row in this case is the database row with the matching
39primary key.
40.It SQLITE_CHANGESET_FOREIGN_KEYIf foreign key handling is enabled, and
41applying a changeset leaves the database in a state containing foreign
42key violations, the conflict handler is invoked with CHANGESET_FOREIGN_KEY
43as the second argument exactly once before the changeset is committed.
44If the conflict handler returns CHANGESET_OMIT, the changes, including
45those that caused the foreign key constraint violation, are committed.
46Or, if it returns CHANGESET_ABORT, the changeset is rolled back.
47.Pp
48No current or conflicting row information is provided.
49The only function it is possible to call on the supplied sqlite3_changeset_iter
50handle is sqlite3changeset_fk_conflicts().
51.It SQLITE_CHANGESET_CONSTRAINTIf any other constraint violation occurs
52while applying a change (i.e.
53a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is invoked
54with CHANGESET_CONSTRAINT as the second argument.
55.Pp
56There is no conflicting row in this case.
57The results of invoking the sqlite3changeset_conflict() API are undefined.
58.El
59.Pp
60