mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Store primary key definitions for modified tables in changesets. Add the sqlite3changeset_pk() API to extract this data from a changeset iterator.
FossilOrigin-Name: 54298ee5ed183d1f1c49524f25e8ae1407f3d4b5
This commit is contained in:
@ -341,6 +341,37 @@ int sqlite3changeset_op(
|
||||
int *pbIndirect /* OUT: True for an 'indirect' change */
|
||||
);
|
||||
|
||||
/*
|
||||
** CAPI3REF: Obtain The Primary Key Definition Of A Table
|
||||
**
|
||||
** For each modified table, a changeset includes the following:
|
||||
**
|
||||
** <ul>
|
||||
** <li> The number of columns in the table, and
|
||||
** <li> Which of those columns make up the tables PRIMARY KEY.
|
||||
** </ul>
|
||||
**
|
||||
** 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 argumet 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.
|
||||
*/
|
||||
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 */
|
||||
);
|
||||
|
||||
/*
|
||||
** CAPI3REF: Obtain old.* Values From A Changeset Iterator
|
||||
**
|
||||
|
Reference in New Issue
Block a user