Mercurial > hg > egg-tcls
comparison quotedb.tcl @ 667:88d0e2ba73ca
quotedb: Use LIKE instead of = for user.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 23 Feb 2021 13:04:24 +0200 |
parents | 96a659f66be9 |
children | a026f5eb9439 |
comparison
equal
deleted
inserted
replaced
666:79b5d8944eea | 667:88d0e2ba73ca |
---|---|
145 } | 145 } |
146 | 146 |
147 set qoverride [matchattr $uhand n] | 147 set qoverride [matchattr $uhand n] |
148 set usql "SELECT utime AS utime FROM $utable WHERE id=$unum" | 148 set usql "SELECT utime AS utime FROM $utable WHERE id=$unum" |
149 if {$qoverride == 0} { | 149 if {$qoverride == 0} { |
150 append usql " AND user='[utl_escape $uhand]'" | 150 append usql " AND user LIKE '[utl_escape $uhand]'" |
151 set qextra "" | 151 set qextra "" |
152 } else { | 152 } else { |
153 set qextra [qdb_qm $utable "update_override"] | 153 set qextra [qdb_qm $utable "update_override"] |
154 } | 154 } |
155 | 155 |
194 } | 194 } |
195 | 195 |
196 set qoverride [matchattr $uhand n] | 196 set qoverride [matchattr $uhand n] |
197 set usql "SELECT utime AS utime FROM $utable WHERE id=$unum" | 197 set usql "SELECT utime AS utime FROM $utable WHERE id=$unum" |
198 if {$qoverride == 0} { | 198 if {$qoverride == 0} { |
199 append usql " AND user='[utl_escape $uhand]'" | 199 append usql " AND user LIKE '[utl_escape $uhand]'" |
200 set qextra "" | 200 set qextra "" |
201 } else { | 201 } else { |
202 set qextra [qdb_qm $utable "update_override"] | 202 set qextra [qdb_qm $utable "update_override"] |
203 } | 203 } |
204 | 204 |
275 qdb_msg $ucmd $utable $upublic $unick $uchan "quote_does_not_exist" [list $uid] | 275 qdb_msg $ucmd $utable $upublic $unick $uchan "quote_does_not_exist" [list $uid] |
276 return 0 | 276 return 0 |
277 } | 277 } |
278 | 278 |
279 # Check if user has previously voted this item | 279 # Check if user has previously voted this item |
280 set usql "SELECT id AS qid FROM ${utable}_votes WHERE user='[utl_escape $uhand]' AND urlid=$uid" | 280 set usql "SELECT id AS qid FROM ${utable}_votes WHERE user LIKE '[utl_escape $uhand]' AND urlid=$uid" |
281 qdb_handle eval $usql { | 281 qdb_handle eval $usql { |
282 # Yes, update the previous vote | 282 # Yes, update the previous vote |
283 set usql "UPDATE ${utable}_votes SET vote=$uvote WHERE id=$qid" | 283 set usql "UPDATE ${utable}_votes SET vote=$uvote WHERE id=$qid" |
284 if {[qdb_sql_exec $ucmd $utable $upublic $unick $uchan $usql]} { | 284 if {[qdb_sql_exec $ucmd $utable $upublic $unick $uchan $usql]} { |
285 set urating [qdb_get_rating_for_id $utable $uid] | 285 set urating [qdb_get_rating_for_id $utable $uid] |