Mercurial > hg > egg-tcls
diff quotedb.tcl @ 697:14d4d4300623
quotedb: When searching quotes, inform user if we found more matches than the max matches limit.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 18 Sep 2023 11:20:46 +0300 |
parents | bd7f06c8a515 |
children | 6ba9f961e463 |
line wrap: on
line diff
--- a/quotedb.tcl Tue Sep 05 00:06:17 2023 +0300 +++ b/quotedb.tcl Mon Sep 18 11:20:46 2023 +0300 @@ -440,13 +440,17 @@ ### Query the database and output results set uresults 0 + set usql "SELECT count(*) AS uresults FROM $utable $fquery" + qdb_handle eval $usql {} + set usql "SELECT id AS quoteID, utime AS utime, utext AS utext, user AS uuser FROM $utable $fquery ORDER BY utime DESC LIMIT $ulimit" qdb_handle eval $usql { - incr uresults qdb_msg $ucmd $utable $upublic $unick $uchan "fmt_search" [list $quoteID $utext $uuser [qdb_ctime $utime]] } - if {$uresults == 0} { + if {$uresults > $ulimit} { + qdb_msg $ucmd $utable $upublic $unick $uchan "num_matches" [list $uresults $ulimit] + } elseif {$uresults == 0} { qdb_msg $ucmd $utable $upublic $unick $uchan "no_matches" return 0 }