xref: /netbsd-src/external/public-domain/sqlite/man/sqlite3changeset_pk.3 (revision b9988867a8ad969c45a52aa7628bc932ec98d46b)
1.Dd January 24, 2024
2.Dt SQLITE3CHANGESET_PK 3
3.Os
4.Sh NAME
5.Nm sqlite3changeset_pk
6.Nd obtain the primary key definition of a table
7.Sh SYNOPSIS
8.In sqlite3.h
9.Ft int
10.Fo sqlite3changeset_pk
11.Fa "sqlite3_changeset_iter *pIter"
12.Fa "unsigned char **pabPK"
13.Fa "int *pnCol"
14.Fc
15.Sh DESCRIPTION
16For each modified table, a changeset includes the following:
17.Bl -bullet
18.It
19The number of columns in the table, and
20.It
21Which of those columns make up the tables PRIMARY KEY.
22.El
23.Pp
24This function is used to find which columns comprise the PRIMARY KEY
25of the table modified by the change that iterator pIter currently points
26to.
27If successful, *pabPK is set to point to an array of nCol entries,
28where nCol is the number of columns in the table.
29Elements of *pabPK are set to 0x01 if the corresponding column is part
30of the tables primary key, or 0x00 if it is not.
31.Pp
32If argument pnCol is not NULL, then *pnCol is set to the number of
33columns in the table.
34.Pp
35If this function is called when the iterator does not point to a valid
36entry, SQLITE_MISUSE is returned and the output variables zeroed.
37Otherwise, SQLITE_OK is returned and the output variables populated
38as described above.
39.Sh IMPLEMENTATION NOTES
40These declarations were extracted from the
41interface documentation at line 11567.
42.Bd -literal
43SQLITE_API int sqlite3changeset_pk(
44  sqlite3_changeset_iter *pIter,  /* Iterator object */
45  unsigned char **pabPK,          /* OUT: Array of boolean - true for PK cols */
46  int *pnCol                      /* OUT: Number of entries in output array */
47);
48.Ed
49