PDA

View Full Version : Query warning in Playlist.pm and Track.pm



quietdragon
2007-03-29, 22:58
Scanning the logfile tonight I see:


2007-03-29 22:43:39.9754 DBIx::Class::ResultSet::single(): Query not guaranteed to return a single row; please declare your unique constraints or use search instead at /usr/share/slimserver/Slim/Schema/ResultSet/Playlist.pm line 123




2007-03-29 22:48:08.4827 DBIx::Class::ResultSet::single(): Query not guaranteed to return a single row; please declare your unique constraints or use search instead at /usr/share/slimserver/Slim/Schema/Track.pm line 95


I'm running SlimServer Version: 6.5.1 - 11206 - RedHat - EN - utf8 in a manual installation (http://forums.slimdevices.com/showthread.php?t=33915).

The lines of code in question are are the return statements in:


sub getPlaylistForClient {
my $self = shift;
my $client = shift;

return $self->single({
'url' => sprintf('clientplaylist://%s', $client->id),
});
}

and


sub artist {
my $self = shift;

# Bug 3824 - check for both types, in the case that an ALBUMARTIST was set.
return $self->contributorsOfType('ARTIST')->single ||
$self->contributorsOfType('TRACKARTIST')->single;
}


Can anyone see what's wrong with these statements that would elicit these warnings?

quietdragon
2007-04-01, 17:30
Ok. The issue is that I'm using version 0.06_999_05-1, and the version bundled with SlimServer is 0.07001.

In version 0.07001, the warning text is disabled with the comment:


# XXX: Disabled since it doesn't infer uniqueness in all cases
# unless ($self->_is_unique_query($attrs->{where})) {
# carp "Query not guaranteed to return a single row"
# . "; please declare your unique constraints or use search instead";
# }