Commit 75779130 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Add LookupByNickname().

parent 2fb69cba
......@@ -251,5 +251,24 @@ sub LookupByDomain($$)
return Lookup($class, $aggregate_urn);
sub LookupByNickname($$)
my ($class, $nickname) = @_;
if ($nickname !~ /^[-\w]+$/) {
return undef;
my $query_result =
DBQueryWarn("select urn from apt_aggregates ".
"where nickname='$nickname'");
return undef
if (!$query_result);
return undef
if (!$query_result->numrows);
my ($aggregate_urn) = $query_result->fetchrow_array();
return Lookup($class, $aggregate_urn);
# _Always_ make sure that this 1 is at the end of the file...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment