aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2013-12-08 20:51:56 -0500
committerEugeniy Mikhailov <evgmik@gmail.com>2013-12-08 20:51:56 -0500
commita676708d39b2c81e19e767c86b8509a0d6f7600f (patch)
tree9b9c812bf5eaf84c95629b083afe1b012c8e4783
parent4786dc137a5e861f10ccf68c581c3dfb46ae1252 (diff)
downloadGradeBook-a676708d39b2c81e19e767c86b8509a0d6f7600f.tar.gz
GradeBook-a676708d39b2c81e19e767c86b8509a0d6f7600f.zip
added begin and end db transaction functions
-rwxr-xr-xlibBasicTableOperations.tcl28
1 files changed, 28 insertions, 0 deletions
diff --git a/libBasicTableOperations.tcl b/libBasicTableOperations.tcl
index 81f85b3..268845e 100755
--- a/libBasicTableOperations.tcl
+++ b/libBasicTableOperations.tcl
@@ -110,3 +110,31 @@ proc DeleteColumnFromTable { table columnname } {
}
}
+set isDbTransactionActive false
+proc begin_db_transaction { } {
+ global isDbTransactionActive
+ if { !$isDbTransactionActive } {
+ set isDbTransactionActive true
+ set eval_str [concat BEGIN TRANSACTION]
+ set err [catch {db eval $eval_str } errStat]
+ if { $err } {
+ htmlErrorMsg $errStat
+ dbg "the following error happen: $errStat" msg_level_critical
+ }
+ }
+}
+
+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
+ dbg "the following error happen: $errStat" msg_level_critical
+ }
+ }
+}
+
+