merge duplicate id lookup functions
authorIan Beckwith <ianb@erislabs.net>
Sun, 17 Oct 2010 04:19:15 +0000 (05:19 +0100)
committerIan Beckwith <ianb@erislabs.net>
Sun, 17 Oct 2010 04:19:15 +0000 (05:19 +0100)
lib/ID3FS/DB.pm
lib/ID3FS/PathElement/Album.pm
lib/ID3FS/PathElement/Artist.pm
lib/ID3FS/PathElement/File.pm
lib/ID3FS/PathElement/Tag.pm
lib/ID3FS/PathElement/Tagval.pm

index 1638c54..29c50e3 100644 (file)
@@ -169,14 +169,6 @@ sub last_update
     return $newval;
 }
 
-sub id
-{
-    my($self, $type, $val)=@_;
-    my $sql="SELECT id FROM $type WHERE name=?";
-    my ($id)=$self->cmd_onerow($sql, $val);
-    return($id);
-}
-
 sub tag_has_values
 {
     my($self, $id)=@_;
index 46836aa..9826fd1 100644 (file)
@@ -12,7 +12,7 @@ sub new
 
     $self->{db}=shift;
     $self->{name}=shift;
-    $self->{id}=($self->{db}->id("albums", $self->{name}));
+    $self->{id}=($self->{db}->lookup_id("albums", $self->{name}));
     return(undef) unless(defined($self->{id}));
     return $self;
 }
index 9bcf4aa..a0bc50b 100644 (file)
@@ -12,7 +12,7 @@ sub new
 
     $self->{db}=shift;
     $self->{name}=shift;
-    $self->{id}=($self->{db}->id("artists", $self->{name}));
+    $self->{id}=($self->{db}->lookup_id("artists", $self->{name}));
     return(undef) unless(defined($self->{id}));
     return $self;
 }
index 6987440..7a5a1c7 100644 (file)
@@ -12,7 +12,7 @@ sub new
 
     $self->{db}=shift;
     $self->{name}=shift;
-    $self->{id}=$self->{db}->id("files", $self->{name});
+    $self->{id}=$self->{db}->lookup_id("files", $self->{name});
     return(undef) unless(defined($self->{id}));
     return $self;
 }
index 3185955..ad68f06 100644 (file)
@@ -13,7 +13,7 @@ sub new
     $self->{db}=shift;
     $self->{name}=shift;
     $self->{parents_id}=shift;
-    $self->{id}=$self->{db}->id("tags", $self->{name});
+    $self->{id}=$self->{db}->lookup_id("tags", $self->{name});
     return(undef) unless(defined($self->{id}));
     return($self);
 }
index 255e2a0..3b2a77b 100644 (file)
@@ -12,7 +12,7 @@ sub new
 
     $self->{db}=shift;
     $self->{name}=shift;
-    $self->{id}=$self->{db}->id("tagvals", $self->{name});
+    $self->{id}=$self->{db}->lookup_id("tagvals", $self->{name});
     return(undef) unless(defined($self->{id}));
     return $self;
 }