Mercurial > hg > egg-tcls
diff quotedb.tcl @ 37:c3c597cac4b6
Add helper function qdb_sql_exec for simplifying certain SQL operations.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 06 Sep 2011 18:21:32 +0300 |
parents | 6e381916b016 |
children | 428f498b6030 |
line wrap: on
line diff
--- a/quotedb.tcl Tue Sep 06 18:19:13 2011 +0300 +++ b/quotedb.tcl Tue Sep 06 18:21:32 2011 +0300 @@ -142,6 +142,16 @@ return [string map {' ''} $str] } +proc qdb_sql_exec { upublic unick uchan usql } { + global quotedb + if {[catch {quotedb eval $usql} uerrmsg]} { + qdb_log "$uerrmsg on SQL:\n$usql" + qdb_msg $upublic $unick $uchan "virhe sörkittäessä tietokantaa. uliskaa." + return 0 + } + return 1 +} + #------------------------------------------------------------------------- proc qdb_add {utable utext uhand unick uhost uchan upublic} {