From: Ian Jackson Date: Fri, 30 Aug 2013 15:18:31 +0000 (+0100) Subject: list-all action X-Git-Tag: test~41 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;ds=sidebyside;h=9ff98feefd4937c61bc4a11b690f716305697de8;p=d.git list-all action --- diff --git a/fyvzl b/fyvzl index e88256c..dc184d7 100755 --- a/fyvzl +++ b/fyvzl @@ -204,14 +204,19 @@ sub action_show { prow($row); } +sub listq ($) { + my ($q) = @_; + while (my $row = $q->fetchrow_hashref()) { + prow($row); + } +} + sub action_list { nomoreargs; my $q = $dbh->prepare("SELECT * FROM addrs WHERE user=?". " ORDER BY localpart"); $q->execute($user); - while (my $row = $q->fetchrow_hashref()) { - prow($row); - } + listq($q); } sub action_list_user { @@ -221,6 +226,15 @@ sub action_list_user { action_list; } +sub action_list_all { + die unless $priv; + nomoreargs; + my $q = $dbh->prepare("SELECT * FROM addrs". + " ORDER BY user, localpart"); + $q->execute(); + listq($q) +} + sub action_insert_exact { die unless $priv; my $row = { };