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

Allow ATTACH and DETACH inside of a transaction.

FossilOrigin-Name: 95e8f31658254dd2df3eeaae337aff0fe2125d170ae966c74f4fc70400e099b1
This commit is contained in:
drh
2017-08-01 00:20:34 +00:00
5 changed files with 21 additions and 29 deletions

View File

@@ -374,8 +374,9 @@ do_test attach2-6.1 {
do_test attach2-6.2 {
catchsql {
ATTACH 'test3.db' as aux2;
DETACH aux2;
}
} {1 {cannot ATTACH database within transaction}}
} {0 {}}
# EVIDENCE-OF: R-59740-55581 This statement will fail if SQLite is in
# the middle of a transaction.
@@ -384,13 +385,7 @@ do_test attach2-6.3 {
catchsql {
DETACH aux;
}
} {1 {cannot DETACH database within transaction}}
do_test attach2-6.4 {
execsql {
COMMIT;
DETACH aux;
}
} {}
} {0 {}}
db close

View File

@@ -616,12 +616,16 @@ ifcapable auth {
# First make sure it is not possible to attach or detach a database while
# a savepoint is open (it is not possible if any transaction is open).
#
# UPDATE 2017-07-26: It is not possible to ATTACH and DETACH within a
# a transaction.
#
do_test savepoint-10.1.1 {
catchsql {
SAVEPOINT one;
ATTACH 'test2.db' AS aux;
DETACH aux;
}
} {1 {cannot ATTACH database within transaction}}
} {0 {}}
do_test savepoint-10.1.2 {
execsql {
RELEASE one;
@@ -630,8 +634,9 @@ do_test savepoint-10.1.2 {
catchsql {
SAVEPOINT one;
DETACH aux;
ATTACH 'test2.db' AS aux;
}
} {1 {cannot DETACH database within transaction}}
} {0 {}}
do_test savepoint-10.1.3 {
execsql {
RELEASE one;