diff options
author | drh <> | 2025-01-22 19:37:47 +0000 |
---|---|---|
committer | drh <> | 2025-01-22 19:37:47 +0000 |
commit | c850c2be757ffbf11423b47f8ef94bd0ce20f048 (patch) | |
tree | f88eda4678b42911d2bd2661c354a13b4f89a7f3 /src/attach.c | |
parent | 9489aefb83fd72aa64fafe6a98617af9dfdcc538 (diff) | |
download | sqlite-c850c2be757ffbf11423b47f8ef94bd0ce20f048.tar.gz sqlite-c850c2be757ffbf11423b47f8ef94bd0ce20f048.zip |
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
Diffstat (limited to 'src/attach.c')
-rw-r--r-- | src/attach.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/attach.c b/src/attach.c index 9f23dce1e..399a6cb53 100644 --- a/src/attach.c +++ b/src/attach.c @@ -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); |