Changeset 62 for trunk/DNSDB.pm


Ignore:
Timestamp:
01/19/10 16:50:05 (14 years ago)
Author:
Kris Deugau
Message:

/trunk

checkpoint
dns.cgi:

Fix lurking rebuglet on removing search filter
Add logging on domain active/inactive
Make sure to propagate error messages on domain add/delete as required
Logging of domain add/delete should now be complete
Record add/delete/update logging should be complete (not completely tested)
Explicitly set $startwith, $filter, and $searchsubs in listdomains()

DNSDB.pm:

Remove debugging cruft in DNSDB
Return the parent ID for a record in getRecLine
Normalize some SQL formatting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r61 r62  
    243243  my $domid = shift;
    244244
    245 return "FAIL", "whee!";
    246245  # Allow transactions, and raise an exception on errors so we can catch it later.
    247246  # Use local to make sure these get "reset" properly on exiting this block
     
    684683  my $id = shift;
    685684
    686   my $sql = "select record_id,host,type,val,distance,weight,port,ttl from ".
    687         (($def eq 'def' or $def eq 'y') ? 'default_' : '').
    688         "records where record_id=$id";
    689 print "MDEBUG: $sql<br>\n";
     685  my $sql = "SELECT record_id,host,type,val,distance,weight,port,ttl".
     686        (($def eq 'def' or $def eq 'y') ? ',group_id FROM default_' : ',domain_id FROM ').
     687        "records WHERE record_id=?";
    690688  my $sth = $dbh->prepare($sql);
    691   $sth->execute;
    692 
    693   my ($recid,$host,$rtype,$val,$distance,$weight,$port,$ttl) = $sth->fetchrow_array();
     689  $sth->execute($id);
     690
     691  my ($recid,$host,$rtype,$val,$distance,$weight,$port,$ttl,$parid) = $sth->fetchrow_array();
    694692
    695693  if ($sth->err) {
     
    706704  $ret{port}    = $port;
    707705  $ret{ttl}     = $ttl;
     706  $ret{parid}   = $parid;
    708707
    709708  return %ret;
     
    728727  my $order = shift || 'host';
    729728
    730   my $sql = "select record_id,host,type,val,distance,weight,port,ttl from";
     729  my $sql = "SELECT record_id,host,type,val,distance,weight,port,ttl FROM ";
    731730  if ($type eq 'def' or $type eq 'y') {
    732731    $sql .= " default_records where group_id=$id";
     
    861860  my $id = shift;
    862861
    863   my $sth = $dbh->prepare("delete from ".($defrec eq 'y' ? 'default_' : '')."records where record_id=?");
     862return "FAIL", "wakka wakka";
     863  my $sth = $dbh->prepare("DELETE FROM ".($defrec eq 'y' ? 'default_' : '')."records WHERE record_id=?");
    864864  $sth->execute($id);
    865865
Note: See TracChangeset for help on using the changeset viewer.