Add tests for urlExists and fix bugs in the method. It now handles

placeholders correctly and does exactly what the POD says, assetId
requires that the url be with that assetId, rather than not in that
assetId.
This commit is contained in:
Colin Kuskie 2007-02-25 06:18:15 +00:00
parent 70d7bb2513
commit 5a379fe91e
2 changed files with 23 additions and 4 deletions

View file

@ -1895,10 +1895,12 @@ sub urlExists {
my $url = lc(shift);
my $options = shift || {};
my $limit = "";
if (defined $options->{assetId}) {
$limit = "and assetId<>?"
my $placeholders = [ $url ];
if (exists $options->{assetId}) {
$limit = "and assetId=?";
push @{ $placeholders }, $options->{assetId};
}
my ($test) = $session->db->quickArray("select count(url) from assetData where url=? $limit", [$url, $options->{assetId}]);
my ($test) = $session->db->quickArray("select count(url) from assetData where url=? $limit", $placeholders);
return $test;
}