SQLITE3CHANGESET_PK(3) Library Functions Manual SQLITE3CHANGESET_PK(3)

sqlite3changeset_pkobtain the primary key definition of a table

#include <sqlite3.h>

int
sqlite3changeset_pk(sqlite3_changeset_iter *pIter, unsigned char **pabPK, int *pnCol);

For each modified table, a changeset includes the following:

This function is used to find which columns comprise the PRIMARY KEY of the table modified by the change that iterator pIter currently points to. If successful, *pabPK is set to point to an array of nCol entries, where nCol is the number of columns in the table. Elements of *pabPK are set to 0x01 if the corresponding column is part of the tables primary key, or 0x00 if it is not.

If argument pnCol is not NULL, then *pnCol is set to the number of columns in the table.

If this function is called when the iterator does not point to a valid entry, SQLITE_MISUSE is returned and the output variables zeroed. Otherwise, SQLITE_OK is returned and the output variables populated as described above.

These declarations were extracted from the interface documentation at line 11567.

SQLITE_API int sqlite3changeset_pk(
  sqlite3_changeset_iter *pIter,  /* Iterator object */
  unsigned char **pabPK,          /* OUT: Array of boolean - true for PK cols */
  int *pnCol                      /* OUT: Number of entries in output array */
);
January 24, 2024 NetBSD 11.0