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

Add the "multiplex_truncate" PRAGMA to the multiplexor extension, for

querying and setting the truncate flag on a database connection.

FossilOrigin-Name: d2962a5f388f30a02429e0c8b87399f482b5604c
This commit is contained in:
drh
2014-09-23 18:30:00 +00:00
parent 14f0e2128a
commit 3b8fea9ec6
4 changed files with 142 additions and 7 deletions

View File

@@ -1002,6 +1002,26 @@ static int multiplexFileControl(sqlite3_file *pConn, int op, void *pArg){
/* no-op these */
rc = SQLITE_OK;
break;
case SQLITE_FCNTL_PRAGMA: {
char **aFcntl = (char**)pArg;
if( aFcntl[1] && sqlite3_stricmp(aFcntl[1],"multiplex_truncate")==0 ){
if( aFcntl[2] && aFcntl[2][0] ){
if( sqlite3_stricmp(aFcntl[2], "on")==0
|| sqlite3_stricmp(aFcntl[2], "1")==0 ){
pGroup->bTruncate = 1;
}else
if( sqlite3_stricmp(aFcntl[2], "off")==0
|| sqlite3_stricmp(aFcntl[2], "0")==0 ){
pGroup->bTruncate = 0;
}
}
aFcntl[0] = sqlite3_mprintf(pGroup->bTruncate ? "on" : "off");
rc = SQLITE_OK;
break;
}
/* If the multiplexor does not handle the pragma, pass it through
** into the default case. */
}
default:
pSubOpen = multiplexSubOpen(pGroup, 0, &rc, NULL, 0);
if( pSubOpen ){