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

Add the SQLITE_FCNTL_VFS_POINTER file control which obtains a pointer to

the top-level VFS in use by a database connection.

FossilOrigin-Name: 7c6a809e25138950f50554e1fb96e0b6ebbe0bd4
This commit is contained in:
drh
2015-11-28 18:06:36 +00:00
parent ecf0c275bb
commit 790f287c53
7 changed files with 41 additions and 13 deletions

View File

@@ -1847,6 +1847,7 @@ static char zHelp[] =
".timeout MS Try opening locked tables for MS milliseconds\n"
".timer on|off Turn SQL timer on or off\n"
".trace FILE|off Output each SQL statement as it is run\n"
".vfsinfo ?AUX? Information about the top-level VFS\n"
".vfsname ?AUX? Print the name of the VFS stack\n"
".width NUM1 NUM2 ... Set column widths for \"column\" mode\n"
" Negative values right-justify\n"
@@ -4067,6 +4068,20 @@ static int do_meta_command(char *zLine, ShellState *p){
sqlite3_libversion(), sqlite3_sourceid());
}else
if( c=='v' && strncmp(azArg[0], "vfsinfo", n)==0 ){
const char *zDbName = nArg==2 ? azArg[1] : "main";
sqlite3_vfs *pVfs;
if( p->db ){
sqlite3_file_control(p->db, zDbName, SQLITE_FCNTL_VFS_POINTER, &pVfs);
if( pVfs ){
fprintf(p->out, "vfs.zName = \"%s\"\n", pVfs->zName);
fprintf(p->out, "vfs.iVersion = %d\n", pVfs->iVersion);
fprintf(p->out, "vfs.szOsFile = %d\n", pVfs->szOsFile);
fprintf(p->out, "vfs.mxPathname = %d\n", pVfs->mxPathname);
}
}
}else
if( c=='v' && strncmp(azArg[0], "vfsname", n)==0 ){
const char *zDbName = nArg==2 ? azArg[1] : "main";
char *zVfsName = 0;