1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

Allocate 4 bytes of unused header space for an "Application ID". Add

the "PRAGMA application_id" command to set and query this identifier.
Add the "magic.txt" file to show how the posix file command might use
this application id.

FossilOrigin-Name: 28c9e7fdee2471a3026ee05ff591194d5f398131
This commit is contained in:
drh
2013-05-01 19:49:27 +00:00
parent a309552e2c
commit 4ee09b4bcc
7 changed files with 63 additions and 11 deletions

View File

@@ -1567,6 +1567,11 @@ void sqlite3Pragma(
** PRAGMA [database.]user_version
** PRAGMA [database.]user_version = <integer>
**
** PRAGMA [database.]freelist_count = <integer>
**
** PRAGMA [database.]application_id
** PRAGMA [database.]application_id = <integer>
**
** The pragma's schema_version and user_version are used to set or get
** the value of the schema-version and user-version, respectively. Both
** the schema-version and the user-version are 32-bit signed integers
@@ -1588,10 +1593,14 @@ void sqlite3Pragma(
if( sqlite3StrICmp(zLeft, "schema_version")==0
|| sqlite3StrICmp(zLeft, "user_version")==0
|| sqlite3StrICmp(zLeft, "freelist_count")==0
|| sqlite3StrICmp(zLeft, "application_id")==0
){
int iCookie; /* Cookie index. 1 for schema-cookie, 6 for user-cookie. */
sqlite3VdbeUsesBtree(v, iDb);
switch( zLeft[0] ){
case 'a': case 'A':
iCookie = BTREE_APPLICATION_ID;
break;
case 'f': case 'F':
iCookie = BTREE_FREE_PAGE_COUNT;
break;