Small. Fast. Reliable.
Choose any three.

About Documentation Download License Support Purchase |

# The Session Extension

## 1.0 Introduction

The session extension provide a mechanism for recording changes to some or all of the rowid tables in an SQLite database, and packaging those changes into a "changeset" or "patchset" file that can later be used to apply the same set of changes to another database with the same schema and compatible starting data. A "changeset" may also be inverted and used to "undo" a session.

This document is an introduction to the session extension. The details of the interface are in the separate Session Extension C-language Interface document.

### 1.1 Typical Use Case

Suppose SQLite is used as the the application file format for a particular design application. Two users, Alice and Bob, each start with a baseline design that is about a gigabyte in size. They work all day, in parallel, each making their own customizations and tweaks to the design. At the end of the day, they would like to merge their changes together into a single unified design.

The session extension facilitates this by recording all changes to both Alice's and Bob's databases and writing those changes into changeset or patchset files. At the end of the day, Alice can send her changeset to Bob and Bob can "apply" it to his database. The result (assuming there are no conflicts) is that Bob's database then contains both his changes and Alice's changes. Likewise, Bob can send a changeset of his work over to Alice and she can apply his changes to her database.

In other words, the session extension provides a facility for SQLite database files that is similar to the unix patch utility program, or to the "merge" capabilities of version control systems such as Fossil, Git, or Mercurial.

### 1.2 Requirements And Limitations

- The session extension requires the SQLITE_ENABLE_PREUPDATE_HOOK compile-time option to enable the preupdate hook interfaces.

- All of the session extension code is omitted from the build unless the SQLITE_ENABLE_SESSION compile-time option is used.

- The session extension only works with rowid tables. Changes to WITHOUT ROWID tables and virtual tables are not captured.

## 2.0 Using The Session Extension

TBD...