Re: [sqlite] Performing Multiple SQL Statements Within A Transactions Using TCL
>>-Original Message- >>From: sqlite-users-boun...@sqlite.org >>[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Gerry Snyder >>Sent: Thursday, October 10, 2013 6:33 PM >>To: General Discussion of SQLite Database >>Subject: Re: [sqlite] Performing Multiple SQL Statements Within A >>Transactions Using TCL >>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)" >>} >>} That really helps! Can you also show me how I would commit or rollback in this example? Thank you! Jerry >>HTH, >>Gerry ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users Disclaimer This email is confidential and intended solely for the use of the individual to whom it is addressed. Any views or opinions presented are solely those of the author and do not necessarily represent those of St. Claire Regional Medical Center. If you are not the intended recipient, be advised that you have received this email in error and that any use, dissemination, forwarding, printing or copying of the email is strictly prohibited. If you received this email in error please notify the St. Claire Regional Helpdesk by telephone at 606-783-6565. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Performing Multiple SQL Statements Within A Transactions Using TCL
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
[sqlite] Performing Multiple SQL Statements Within A Transactions Using TCL
All, Does anybody have any examples of wrapping multiple SQL insert/update statements in a transaction using the TCL API? Thanks, Jerry Tilsley, CIS Lvl 2 St. Claire Regional Medical Center Sr Systems Analyst jerry.tils...@st-claire.org Disclaimer This email is confidential and intended solely for the use of the individual to whom it is addressed. Any views or opinions presented are solely those of the author and do not necessarily represent those of St. Claire Regional Medical Center. If you are not the intended recipient, be advised that you have received this email in error and that any use, dissemination, forwarding, printing or copying of the email is strictly prohibited. If you received this email in error please notify the St. Claire Regional Helpdesk by telephone at 606-783-6565. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users