aboutsummaryrefslogtreecommitdiff
path: root/libBasicTableOperations.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'libBasicTableOperations.tcl')
-rwxr-xr-xlibBasicTableOperations.tcl29
1 files changed, 15 insertions, 14 deletions
diff --git a/libBasicTableOperations.tcl b/libBasicTableOperations.tcl
index 04c6d00..70b8dab 100755
--- a/libBasicTableOperations.tcl
+++ b/libBasicTableOperations.tcl
@@ -110,11 +110,12 @@ proc DeleteColumnFromTable { table columnname } {
}
}
-set isDbTransactionActive false
+set beginTransactionCounter 0
proc begin_db_transaction { } {
- global isDbTransactionActive
- if { !$isDbTransactionActive } {
- set isDbTransactionActive true
+ global beginTransactionCounter
+ incr beginTransactionCounter
+ if { $beginTransactionCounter == 1 } {
+ # starting transaction
set eval_str [concat BEGIN TRANSACTION]
set err [catch {db eval $eval_str } errStat]
if { $err } {
@@ -125,16 +126,16 @@ proc begin_db_transaction { } {
}
proc end_db_transaction { } {
- global isDbTransactionActive
- if { $isDbTransactionActive } {
- set isDbTransactionActive false
- set eval_str [concat END TRANSACTION]
- set err [catch {db eval $eval_str } errStat]
- if { $err } {
- htmlErrorMsg $errStat end_db_transaction
- dbg "the following error happen: $errStat" msg_level_critical begin_db_transaction
- }
- }
+ global beginTransactionCounter
+ incr beginTransactionCounter -1
+ if { $beginTransactionCounter > 0 } return;
+ # closing transaction
+ set eval_str [concat END TRANSACTION]
+ set err [catch {db eval $eval_str } errStat]
+ if { $err } {
+ htmlErrorMsg $errStat end_db_transaction
+ dbg "the following error happen: $errStat" msg_level_critical begin_db_transaction
+ }
}