On 10/10/2013 2:14 PM, Tilsley, Jerry M. wrote:
All,

Does anybody have any examples of wrapping multiple SQL insert/update 
statements in a transaction using the TCL API?


Sure:

db transaction {
db eval {create table if not exists s2011.tclcode(procname text, version text, tcl text, comments text, unique(procname, version))}
    db eval {delete from s2011.tclcode}
    foreach table $tablelist {
        set shorttablename [lindex [split $table .] 1]
        set tc [db eval "select tcl, comments from $table limit 1"]
        set t [lindex $tc 0]
        set c [lindex $tc 1]
db eval "insert into s2011.tclcode(procname, version, tcl, comments) values(:shorttablename,:::GEB::defaultversion,:t,:c)"
    }
}


HTH,

Gerry
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to