Mercurial > hg > egg-tcls
comparison quotedb.tcl @ 59:415c47fcc518
quotedb: Cleanups. We do not need to SELECT quoteID for these operations, we already know what it is.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 08 Sep 2011 22:16:00 +0300 |
parents | 0da3461eb871 |
children | ce327469582c |
comparison
equal
deleted
inserted
replaced
58:0da3461eb871 | 59:415c47fcc518 |
---|---|
198 if {![regexp {^\s*([0-9]+)$} $utext umatch unum]} { | 198 if {![regexp {^\s*([0-9]+)$} $utext umatch unum]} { |
199 qdb_msg $upublic $unick $uchan "$ucmd del <id>" | 199 qdb_msg $upublic $unick $uchan "$ucmd del <id>" |
200 return 0 | 200 return 0 |
201 } | 201 } |
202 | 202 |
203 set usql "SELECT id AS quoteID, utime AS utime, utext AS utext, user AS uuser, host AS uhost FROM $utable WHERE id=$unum AND user='[qdb_escape $uhand]'" | 203 set usql "SELECT utime AS utime FROM $utable WHERE id=$unum AND user='[qdb_escape $uhand]'" |
204 quotedb eval $usql { | 204 quotedb eval $usql { |
205 set udiff [expr [unixtime] - $utime] | 205 set udiff [expr [unixtime] - $utime] |
206 if {$udiff < $maxdiff} { | 206 if {$udiff < $maxdiff} { |
207 set usql "DELETE FROM $utable WHERE id=$quoteID AND user='[qdb_escape $uhand]'" | 207 set usql "DELETE FROM $utable WHERE id=$unum AND user='[qdb_escape $uhand]'" |
208 if {![qdb_sql_exec $upublic $unick $uchan $usql]} { | 208 if {![qdb_sql_exec $upublic $unick $uchan $usql]} { |
209 return 0 | 209 return 0 |
210 } else { | 210 } else { |
211 set usql "DELETE FROM ${utable}_votes WHERE urlid=$quoteID" | 211 set usql "DELETE FROM ${utable}_votes WHERE urlid=$unum" |
212 if {![qdb_sql_exec $upublic $unick $uchan $usql]} { | 212 if {![qdb_sql_exec $upublic $unick $uchan $usql]} { |
213 return 0 | 213 return 0 |
214 } | 214 } |
215 qdb_msg $upublic $unick $uchan "$utable ID #$quoteID poistettu." | 215 qdb_msg $upublic $unick $uchan "$utable #$unum poistettu." |
216 return 1 | 216 return 1 |
217 } | 217 } |
218 } else { | 218 } else { |
219 qdb_msg $upublic $unick $uchan "$utable quote #$quoteID vanhempi kuin $qdb_max_deltime minuuttia, ei poisteta." | 219 qdb_msg $upublic $unick $uchan "$utable quote #$unum vanhempi kuin $qdb_max_deltime minuuttia, ei poisteta." |
220 return 0 | 220 return 0 |
221 } | 221 } |
222 } | 222 } |
223 | 223 |
224 qdb_msg $upublic $unick $uchan "#$unum ei löydy, tai se ei kuulu käyttäjälle '$uhand'." | 224 qdb_msg $upublic $unick $uchan "#$unum ei löydy, tai se ei kuulu käyttäjälle '$uhand'." |