Skip to content
Snippets Groups Projects
Commit 5f56ff51 authored by Glenn Proctor's avatar Glenn Proctor
Browse files

Added _list_dbIDs - provides functionality that will be used in subclasses.

parent 05ec2ad5
No related branches found
No related tags found
No related merge requests found
......@@ -204,4 +204,29 @@ sub deleteObj {
}
# list primary keys for a particular table
# args are table name and primary key field
# if primary key field is not supplied, tablename_id is assumed
# returns listref of IDs
sub _list_dbIDs {
my ($self, $table, $pk) = @_;
if (!defined($pk)) {
$pk = $table . "_id";
}
my @out;
my $sql = "SELECT " . $pk . " FROM " . $table;
my $sth = $self->prepare($sql);
$sth->execute;
while (my ($id) = $sth->fetchrow) {
push(@out, $id);
}
$sth->finish;
return \@out;
}
1;
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