comparison quotedb.tcl @ 671:3904fcfeeb9a

quotedb: Rename qdb_get() to qdb_show() and remove extraneous unused argument.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 23 Feb 2021 14:41:42 +0200
parents fdd20366406e
children f55dc6599308
comparison
equal deleted inserted replaced
670:fdd20366406e 671:3904fcfeeb9a
300 } 300 }
301 } 301 }
302 302
303 303
304 #------------------------------------------------------------------------- 304 #-------------------------------------------------------------------------
305 proc qdb_get {ucmd utable upublic unick uhost uhand uchan utext uindex} { 305 proc qdb_show {ucmd utable upublic unick uhost uhand uchan uindex} {
306 global qdb_handle 306 global qdb_handle
307 307
308 set usql "SELECT total(${utable}_votes.vote) AS uvote, ${utable}.id AS quoteID, ${utable}.utext AS uquote, ${utable}.utime AS utime, ${utable}.user AS uuser FROM ${utable} LEFT JOIN ${utable}_votes ON ${utable}_votes.urlid = ${utable}.id" 308 set usql "SELECT total(${utable}_votes.vote) AS uvote, ${utable}.id AS quoteID, ${utable}.utext AS uquote, ${utable}.utime AS utime, ${utable}.user AS uuser FROM ${utable} LEFT JOIN ${utable}_votes ON ${utable}_votes.urlid = ${utable}.id"
309 309
310 if {$uindex >= 0} { 310 if {$uindex >= 0} {
450 # Trim argument text 450 # Trim argument text
451 set utext [string trim $utext] 451 set utext [string trim $utext]
452 452
453 if {$utext == "" || $utext == {}} { 453 if {$utext == "" || $utext == {}} {
454 # No arguments, assume random query 454 # No arguments, assume random query
455 qdb_get $ucmd $utable $upublic $unick $uhost $uhand $uchan $utext -1 455 qdb_show $ucmd $utable $upublic $unick $uhost $uhand $uchan -1
456 } elseif {[regexp {^(stat|stats|tilasto|tilastot)$} $utext]} { 456 } elseif {[regexp {^(stat|stats|tilasto|tilastot)$} $utext]} {
457 # Statistics 457 # Statistics
458 qdb_stats $ucmd $utable $upublic $unick $uhost $uhand $uchan $utext 458 qdb_stats $ucmd $utable $upublic $unick $uhost $uhand $uchan $utext
459 } elseif {[regexp {^(last|latest|uusin|viimeisin)$} $utext]} { 459 } elseif {[regexp {^(last|latest|uusin|viimeisin)$} $utext]} {
460 # Latest added 460 # Latest added
461 qdb_get $ucmd $utable $upublic $unick $uhost $uhand $uchan $utext -2 461 qdb_show $ucmd $utable $upublic $unick $uhost $uhand $uchan -2
462 } elseif {[regexp {^([0-9]+)$} $utext -> unum]} { 462 } elseif {[regexp {^([0-9]+)$} $utext -> unum]} {
463 # Numeric argument, assume id query 463 # Numeric argument, assume id query
464 qdb_get $ucmd $utable $upublic $unick $uhost $uhand $uchan $utext $unum 464 qdb_show $ucmd $utable $upublic $unick $uhost $uhand $uchan $unum
465 } elseif {[regexp {^top\s*([0-9]+)?$} $utext -> uargs]} { 465 } elseif {[regexp {^top\s*([0-9]+)?$} $utext -> uargs]} {
466 # Toplist of quotes 466 # Toplist of quotes
467 qdb_toplist $ucmd $utable $upublic $unick $uhost $uhand $uchan $utext $uargs 467 qdb_toplist $ucmd $utable $upublic $unick $uhost $uhand $uchan $utext $uargs
468 } elseif {[regexp {^add\s*(.*)$} $utext -> uargs]} { 468 } elseif {[regexp {^add\s*(.*)$} $utext -> uargs]} {
469 # Add quote 469 # Add quote