Thread: Fw: pg_TCL and COMMIT
Anybody?
----- Original Message -----
From: Paul Skinner
Sent: Monday, July 10, 2000 5:30 PM
Subject: pg_TCL and COMMIT
Greetings,
Just joined the list and hope someone can answer this for me.
Why can't I successfully use a SELECT statement within a transaction (BEGIN) ? I get a message saying that the transaction is aborted, as a result I have to build all my queries in a list and issue them to the backend on the outside of a loop. I pretty sure I did it with oratcl for 8.0.x but I don't have an environment ready to try it...
.... set srvrrules ""
# An array of hosts and info...
foreach rule [array names rules_array] {
foreach rule [array names rules_array] {
# Get the key to the rule
set ruleidx [findrule $rule $conn]
set ruleidx [findrule $rule $conn]
# If it didn't return, add the rule to the DB ...
if {[string length $ruleidx] == 0} {
addrule $rule $conn
}
if {[string length $ruleidx] == 0} {
addrule $rule $conn
}
# .... and get it's key.
set ruleidx [findrule $rule $conn]
# RUNNING THE UPDATE HERE WOULD BE COOL!!
set ruleidx [findrule $rule $conn]
# RUNNING THE UPDATE HERE WOULD BE COOL!!
# but I add it to a list instead, because putting the key checks in the BEGIN;
# causes the TX to abort.
lappend SQLRules [ SQLaddsrvrrule $ruleidx $srvridx $rules_array($rule)]
}
ExecSql "BEGIN;" $conn
ExecSql "Delete from GG_srvr_rules where srvr = $srvridx;" $conn
ExecSql "update GG_players set online = 'f' where srvr = $srvridx" $conn
}
ExecSql "BEGIN;" $conn
ExecSql "Delete from GG_srvr_rules where srvr = $srvridx;" $conn
ExecSql "update GG_players set online = 'f' where srvr = $srvridx" $conn
foreach statement $SQLRules {
ExecSql $statement $conn
}
ExecSql "COMMIT;" $conn
unset SQLRules
....
Paul