SQLite PRAGMA

PRAGMA data_version

The "PRAGMA data_version" command provides an indication that the database file has been modified.

PRAGMA schema.data_version;

On the sample database

What PRAGMA data_version returns on the sample database, in SQLite 3.54.1 as built for the browser by sql.js:

data_version
2

What the SQLite documentation says

The "PRAGMA data_version" command provides an indication that the database file has been modified. Interactive programs that hold database content in memory or that display database content on-screen can use the PRAGMA data_version command to determine if they need to flush and reload their memory or update the screen display.

The integer values returned by two invocations of "PRAGMA data_version" from the same connection will be different if changes were committed to the database by any other connection in the interim. The "PRAGMA data_version" value is unchanged for commits made on the same database connection. The behavior of "PRAGMA data_version" is the same for all database connections, including database connections in separate processes and shared cache database connections.

The "PRAGMA data_version" value is a local property of each database connection and so values returned by two concurrent invocations of "PRAGMA data_version" on separate database connections are often different even though the underlying database is identical. It is only meaningful to compare the "PRAGMA data_version" values returned by the same database connection at two different points in time.

From sqlite.org's pragma documentation for SQLite 3.54.1, in the public domain.

← data_store_directory · database_list →