Skip Menu |

This queue is for tickets about the PowerDNS-Backend-MySQL CPAN distribution.

Report information
The Basics
Id: 64388
Status: resolved
Priority: 0/
Queue: PowerDNS-Backend-MySQL

People
Owner: Nobody in particular
Requestors: maysara.abdulhaq [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.09
Fixed in: (no value)



Subject: List of all records of a certain domain
I hope to have this functionality, to list all records of a certain domain, i want to delete all records related to a domain ... i would iterate into them , something like "SELECT name,content,ttl,prio FROM records WHERE domain_id = (SELECT id FROM domains WHERE name = ?)") " or maybe make list_records rr field optional , if not there return all records.
if you could tell me if its preferred to make list_records accept a "special" argument to list all records; such as "ALL", or if a new sub is to be introduced so maybe i can provide a patch.
RT-Send-CC: maysara.abdulhaq [...] gmail.com
Submit a patch for a new method called list_all_records that takes a domain name as a scalar reference. Basically copy list_records and make your changes.
Please find attached patch ...
Subject: list_all_records.diff
--- MySQL.pm.bak 2011-01-04 15:08:42.000000000 +0000 +++ MySQL.pm 2011-01-04 15:53:10.000000000 +0000 @@ -385,6 +385,29 @@ return \@records; } +=head2 list_all_records(\$domain) + +Expects a scalar reference to a domain name. +Returns a reference to a two-dimensional array which contains the resource record name, type, +content, TTL, and priority if any of the supplied domain. + +=cut + +sub list_all_records($$) +{ + my $self = shift; + my $domain = shift; + my @records; + + my $sth = $self->{'dbh'}->prepare("SELECT name,type,content,ttl,prio FROM records WHERE domain_id = (SELECT id FROM domains WHERE name = ?)"); + $sth->execute($$domain); + + while ( my ($name,$type,$content,$ttl,$prio) = $sth->fetchrow_array ) + { push @records , [ ($name,$type,$content,$ttl,$prio) ]; } # push anonymous array on to end. + + return \@records; +} + =head2 add_record(\$rr , \$domain) Adds a single record to the backend.
On Tue Jan 04 19:49:12 2011, http://almotashael.blogspot.com/ wrote: Show quoted text
> Please find attached patch ...
Any updates, is there something missing ? will this be released soon as part of the module ?
On Fri Feb 04 21:54:11 2011, http://almotashael.blogspot.com/ wrote: Show quoted text
> On Tue Jan 04 19:49:12 2011, http://almotashael.blogspot.com/ wrote:
> > Please find attached patch ...
> Any updates, is there something missing ? will this be released soon as > part of the module ?
Functionality added in the latest 0.10 release.