176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
|
** atexit() handler that cleans up global state modified by this module.
*/
static void sqlcmd_atexit(void) {
g.zConfigDbName = 0; /* prevent panic */
}
/*
** 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;
}
#if USE_SEE
/*
** This routine is called by the patched sqlite3 command-line shell in order
** to load the encryption key for the open Fossil database. The memory that
** is pointed to by the value placed in pzKey must be obtained from SQLite.
*/
|
|
|
|
<
>
>
>
>
>
>
>
>
>
|
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
|
** atexit() handler that cleans up global state modified by this module.
*/
static void sqlcmd_atexit(void) {
g.zConfigDbName = 0; /* prevent panic */
}
/*
** This routine is called by the sqlite3 command-line shell to
** to load the name the Fossil repository database.
*/
void sqlcmd_get_dbname(const char **pzRepoName){
*pzRepoName = g.zRepositoryName;
}
/*
** This routine is called by the sqlite3 command-line shell to do
** extra initialization prior to starting up the shell.
*/
void sqlcmd_init_proc(void){
sqlite3_initialize();
sqlite3_auto_extension((void(*)(void))sqlcmd_autoinit);
}
#if USE_SEE
/*
** This routine is called by the patched sqlite3 command-line shell in order
** to load the encryption key for the open Fossil database. The memory that
** is pointed to by the value placed in pzKey must be obtained from SQLite.
*/
|
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
|
*pzKey = zKey;
if( fossil_getenv("FOSSIL_USE_SEE_TEXTKEY")==0 ){
*pnKey = (int)strlen(zKey);
}else{
*pnKey = -1;
}
}else{
fossil_fatal("failed to allocate %u bytes for key", nByte);
}
}
#endif
/*
** This routine closes the Fossil databases and/or invalidates the global
** state variables that keep track of them.
|
|
|
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
|
*pzKey = zKey;
if( fossil_getenv("FOSSIL_USE_SEE_TEXTKEY")==0 ){
*pnKey = (int)strlen(zKey);
}else{
*pnKey = -1;
}
}else{
fossil_panic("failed to allocate %u bytes for key", nByte);
}
}
#endif
/*
** This routine closes the Fossil databases and/or invalidates the global
** state variables that keep track of them.
|
291
292
293
294
295
296
297
298
299
300
301
|
fossil_close(1, noRepository);
sqlite3_shutdown();
#ifndef _WIN32
linenoiseSetMultiLine(1);
#endif
atexit(sqlcmd_atexit);
g.zConfigDbName = zConfigDb;
sqlite3_shell(g.argc-1, g.argv+1);
sqlite3_cancel_auto_extension((void(*)(void))sqlcmd_autoinit);
fossil_close(0, noRepository);
}
|
>
|
|
299
300
301
302
303
304
305
306
307
308
309
310
|
fossil_close(1, noRepository);
sqlite3_shutdown();
#ifndef _WIN32
linenoiseSetMultiLine(1);
#endif
atexit(sqlcmd_atexit);
g.zConfigDbName = zConfigDb;
g.argv[1] = "-quote";
sqlite3_shell(g.argc, g.argv);
sqlite3_cancel_auto_extension((void(*)(void))sqlcmd_autoinit);
fossil_close(0, noRepository);
}
|