- Timestamp:
- 09/01/11 14:46:37 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DNSDB.pm
r112 r116 34 34 &getSOA &getRecLine &getDomRecs &getRecCount 35 35 &addRec &updateRec &delRec 36 &isParent 36 37 &domStatus &importAXFR 37 38 &export … … 51 52 &getSOA &getRecLine &getDomRecs &getRecCount 52 53 &addRec &updateRec &delRec 54 &isParent 53 55 &domStatus &importAXFR 54 56 &export … … 404 406 my $state = shift; 405 407 return ('FAIL',"Need domain status") if !defined($state); 408 409 $state = 1 if $state =~ /^active$/; 410 $state = 1 if $state =~ /^on$/; 411 $state = 0 if $state =~ /^inactive$/; 412 $state = 0 if $state =~ /^off$/; 413 414 return ('FAIL',"Invalid domain status") if $state !~ /^\d+$/; 406 415 407 416 my $sth = $dbh->prepare("SELECT domain_id FROM domains WHERE domain=?"); … … 1311 1320 return ('OK','OK'); 1312 1321 } # end delRec() 1322 1323 1324 ## DNSDB::getParents() 1325 # Find out which entities are parent to the requested id 1326 # Returns arrayref containing hash pairs of id/type 1327 sub getParents { 1328 my $dbh = shift; 1329 my $id = shift; 1330 my $type = shift; 1331 1332 # Get immediate parent 1333 $par_col = 'group_id'; 1334 1335 if ($type eq 'user') { 1336 $table = 'users'; 1337 $id_col = 'user_id'; 1338 } 1339 if ($type eq 'defrec') { 1340 $table = 'default_records'; 1341 $id_col = 'record_id'; 1342 } 1343 if ($type eq 'domain') { 1344 $table = 'domains'; 1345 $id_col = 'domain_id'; 1346 } 1347 if ($type eq 'record') { 1348 $table = 'records'; 1349 $id_col = 'record_id'; 1350 $par_col = 'domain_id'; 1351 } 1352 1353 $dbh->do("SELECT $par_col FROM $table WHERE $id_col = ?", 1354 1355 } # end getParents() 1313 1356 1314 1357
Note:
See TracChangeset
for help on using the changeset viewer.