Mercurial > hg > egg-tcls
comparison tj.tcl @ 615:1dac9129eb0f
tj: Change #id handling to be case-insensitive.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 10 Feb 2021 12:34:12 +0200 |
parents | 8c61b4032648 |
children | 20dba2c757de |
comparison
equal
deleted
inserted
replaced
614:8c61b4032648 | 615:1dac9129eb0f |
---|---|
92 global tj_default_id | 92 global tj_default_id |
93 upvar $rindex uindex | 93 upvar $rindex uindex |
94 upvar $rid uid | 94 upvar $rid uid |
95 | 95 |
96 if {[string index $rstr 0] == "#"} { | 96 if {[string index $rstr 0] == "#"} { |
97 set uid [string tolower [string range $rstr 1 end]] | 97 set uid [string range $rstr 1 end] |
98 incr uindex | 98 incr uindex |
99 return 1 | 99 return 1 |
100 } else { | 100 } else { |
101 set uid $tj_default_id | 101 set uid $tj_default_id |
102 return 0 | 102 return 0 |
168 | 168 |
169 | 169 |
170 proc tj_display_tjs {upublic unick uchan uname uid} { | 170 proc tj_display_tjs {upublic unick uchan uname uid} { |
171 set uclock [clock seconds] | 171 set uclock [clock seconds] |
172 set nresults 0 | 172 set nresults 0 |
173 set usql "SELECT * FROM tj WHERE uuser='[utl_escape $uname]' AND utype=0 AND uid='[utl_escape $uid]'" | 173 set usql "SELECT * FROM tj WHERE uuser='[utl_escape $uname]' AND utype=0 AND uid LIKE '[utl_escape $uid]'" |
174 tj_dbh eval $usql { | 174 tj_dbh eval $usql { |
175 incr nresults | 175 incr nresults |
176 set ustamp [utl_sql_datetime_to_stamp $utarget] | 176 set ustamp [utl_sql_datetime_to_stamp $utarget] |
177 set udelta [expr $ustamp - $uclock] | 177 set udelta [expr $ustamp - $uclock] |
178 | 178 |
286 } | 286 } |
287 | 287 |
288 # Check if ID exists | 288 # Check if ID exists |
289 set umode 1 | 289 set umode 1 |
290 set nres 0 | 290 set nres 0 |
291 set usql "SELECT * FROM tj WHERE uid='[utl_escape $uid]'" | 291 set usql "SELECT * FROM tj WHERE uid LIKE '[utl_escape $uid]'" |
292 tj_dbh eval $usql { | 292 tj_dbh eval $usql { |
293 set umode 0 | 293 set umode 0 |
294 set cid $id | 294 set cid $id |
295 set ctarget $utarget | 295 set ctarget $utarget |
296 incr nres | 296 incr nres |
355 if {$rstamp != "invalid"} { | 355 if {$rstamp != "invalid"} { |
356 lappend usqlargs "utarget='$rdate'" | 356 lappend usqlargs "utarget='$rdate'" |
357 } | 357 } |
358 | 358 |
359 if {[llength $usqlargs] > 0} { | 359 if {[llength $usqlargs] > 0} { |
360 set usql "UPDATE tj SET [join $usqlargs ,] WHERE uid='[utl_escape $uid]'" | 360 set usql "UPDATE tj SET [join $usqlargs ,] WHERE uid LIKE '[utl_escape $uid]'" |
361 if {[catch {tj_dbh eval $usql} uerrmsg]} { | 361 if {[catch {tj_dbh eval $usql} uerrmsg]} { |
362 tj_msg $upublic $unick $uchan "err_sql" [list $uerrmsg] | 362 tj_msg $upublic $unick $uchan "err_sql" [list $uerrmsg] |
363 tj_log "$uerrmsg on SQL:\n$usql" | 363 tj_log "$uerrmsg on SQL:\n$usql" |
364 return 1 | 364 return 1 |
365 } | 365 } |