1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-12-21 13:38:01 +03:00

Add two new sqlite3_db_config() options that enable the ATTACH command

to create new database files and to open databases read/write.  Both
default to on for backwards compatibility.

FossilOrigin-Name: fe0c58d00b491d1af7c0894f5c32542954aeea2e6510853b3bcbf13ac0bf5ce0
This commit is contained in:
drh
2025-01-22 19:37:47 +00:00
parent 9489aefb83
commit c850c2be75
7 changed files with 67 additions and 13 deletions

View File

@@ -175,6 +175,12 @@ static void attachFunc(
sqlite3_free(zErr);
return;
}
if( (db->flags & SQLITE_AttachWrite)==0 ){
flags &= ~(SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE);
flags |= SQLITE_OPEN_READONLY;
}else if( (db->flags & SQLITE_AttachCreate)==0 ){
flags &= ~SQLITE_OPEN_CREATE;
}
assert( pVfs );
flags |= SQLITE_OPEN_MAIN_DB;
rc = sqlite3BtreeOpen(pVfs, zPath, db, &pNew->pBt, 0, flags);