diff options
author | Yorhel <git@yorhel.nl> | 2009-01-25 12:30:50 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2009-01-25 12:30:50 +0100 |
commit | e1835977fea7be42b702275ac88e69921d82777d (patch) | |
tree | 54d1ed5ef562a1672cea66975d90ce27864c094c /lib/VNDB/DB/Misc.pm | |
parent | 63c5fe06d0d4bd0c07f50c39fc26170b2bcc7096 (diff) |
Random quote feature
Diffstat (limited to 'lib/VNDB/DB/Misc.pm')
-rw-r--r-- | lib/VNDB/DB/Misc.pm | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/VNDB/DB/Misc.pm b/lib/VNDB/DB/Misc.pm index 14ef45ac..c13a38d2 100644 --- a/lib/VNDB/DB/Misc.pm +++ b/lib/VNDB/DB/Misc.pm @@ -6,7 +6,7 @@ use warnings; use Exporter 'import'; our @EXPORT = qw| - dbStats dbRevisionInsert dbItemInsert dbRevisionGet dbItemMod dbLanguages + dbStats dbRevisionInsert dbItemInsert dbRevisionGet dbItemMod dbLanguages dbRandomQuote |; @@ -173,6 +173,16 @@ sub dbLanguages { } +# Returns a random quote (hashref with keys = vid, quote) +sub dbRandomQuote { + return $_[0]->dbRow(q| + SELECT vid, quote + FROM quotes + ORDER BY RANDOM() + LIMIT 1|); +} + + 1; |