SQLITE3CHANGEGROUP_SCHEMA(3)

SQLITE3CHANGEGROUP_SCHEMA(3) | Library Functions Manual | SQLITE3CHANGEGROUP_SCHEMA(3)

# NAME

`sqlite3changegroup_schema` — add a schema to a changegroup

# SYNOPSIS

`#include <sqlite3.h>`

int
`sqlite3changegroup_schema`(sqlite3_changegroup*, sqlite3*, const char *zDb);

# DESCRIPTION

This method may be used to optionally enforce the rule that the changesets added to the changegroup handle must match the schema of database zDb ("main", "temp", or the name of an attached database). If sqlite3changegroup_add() is called to add a changeset that is not compatible with the configured schema, SQLITE_SCHEMA is returned and the changegroup object is left in an undefined state.

A changeset schema is considered compatible with the database schema in the same way as for sqlite3changeset_apply(). Specifically, for each table in the changeset, there exists a database table with:

- The name identified by the changeset, and
- at least as many columns as recorded in the changeset, and
- the primary key columns in the same position as recorded in the changeset.

The output of the changegroup object always has the same schema as the database nominated using this function. In cases where changesets passed to sqlite3changegroup_add() have fewer columns than the corresponding table in the database schema, these are filled in using the default column values from the database schema. This makes it possible to combined changesets that have different numbers of columns for a single table within a changegroup, provided that they are otherwise compatible.

# IMPLEMENTATION NOTES

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

    SQLITE_API int sqlite3changegroup_schema(sqlite3_changegroup*, sqlite3*, const char *zDb);

January 24, 2024 | NetBSD 11.0