Fossil

Check-in [aa22b1b4]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make the default vfs survive after a sqlite3_shutdown (for "fossil sqlite" command).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:aa22b1b46285a9fe0bd5fc2e4036e60060818752
User & Date: jan.nijtmans 2013-12-10 14:22:14
Context
2013-12-10
21:15
Avoid attempting to preserve the default VFS if it has not been set. check-in: fffcf60c user: mistachkin tags: trunk
14:22
Make the default vfs survive after a sqlite3_shutdown (for "fossil sqlite" command). check-in: aa22b1b4 user: jan.nijtmans tags: trunk
13:23
Add new command line option "-vfs" which overrides the FOSSIL_VFS environment variable, and which works for all future DB connections. Fix .vfsname output when win32-longpath is chosen explicitly (already in SQLite trunk). check-in: eb3899ce user: jan.nijtmans tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/sqlcmd.c.

122
123
124
125
126
127
128

129
130
131
132
133
134
135
...
140
141
142
143
144
145
146


147
148
149
150
151
152
153
154
155
156

157
158
159
                          sqlcmd_decompress, 0, 0);
  re_add_sql_func(db);
  g.repositoryOpen = 1;
  g.db = db;
  return SQLITE_OK;
}



/*
** COMMAND: sqlite3
**
** Usage: %fossil sqlite3 ?DATABASE? ?OPTIONS?
**
** Run the standalone sqlite3 command-line shell on DATABASE with OPTIONS.
................................................................................
** in ways that are unrecoverable.  Be sure you know what you are doing before
** running any SQL commands that modifies the repository database.
*/
void sqlite3_cmd(void){
  extern int sqlite3_shell(int, char**);
  db_find_and_open_repository(OPEN_ANY_SCHEMA, 0);
  db_close(1);


  sqlite3_shutdown();
  sqlite3_shell(g.argc-1, g.argv+1);
  g.db = 0;
}

/*
** This routine is called by the patched sqlite3 command-line shell in order
** to load the name and database connection for the open Fossil database.
*/
void fossil_open(const char **pzRepoName){

  sqlite3_auto_extension((void(*)(void))sqlcmd_autoinit);
  *pzRepoName = g.zRepositoryName;
}







>







 







>
>










>



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
...
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
                          sqlcmd_decompress, 0, 0);
  re_add_sql_func(db);
  g.repositoryOpen = 1;
  g.db = db;
  return SQLITE_OK;
}

static sqlite3_vfs *pDefaultVfs = 0;

/*
** COMMAND: sqlite3
**
** Usage: %fossil sqlite3 ?DATABASE? ?OPTIONS?
**
** Run the standalone sqlite3 command-line shell on DATABASE with OPTIONS.
................................................................................
** in ways that are unrecoverable.  Be sure you know what you are doing before
** running any SQL commands that modifies the repository database.
*/
void sqlite3_cmd(void){
  extern int sqlite3_shell(int, char**);
  db_find_and_open_repository(OPEN_ANY_SCHEMA, 0);
  db_close(1);
  /* Determine default VFS and keep it after shutdown */
  pDefaultVfs = sqlite3_vfs_find(0);
  sqlite3_shutdown();
  sqlite3_shell(g.argc-1, g.argv+1);
  g.db = 0;
}

/*
** This routine is called by the patched sqlite3 command-line shell in order
** to load the name and database connection for the open Fossil database.
*/
void fossil_open(const char **pzRepoName){
  sqlite3_vfs_register(pDefaultVfs, 1);
  sqlite3_auto_extension((void(*)(void))sqlcmd_autoinit);
  *pzRepoName = g.zRepositoryName;
}