Changeset 814
- Timestamp:
- 03/08/16 16:51:06 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/IPDB.pm
r812 r814 3161 3161 3162 3162 # Note city, vrf, parent_id and master_id removed due to JOIN uncertainty for block allocations 3163 my $commonfields = q( custid, type, circuitid, description, notes,modifystamp AS lastmod,3164 privdata, vlan,rdns);3163 my $commonfields = q(a.custid, a.type, a.circuitid, a.description, a.notes, a.modifystamp AS lastmod, 3164 a.privdata, a.vlan, a.rdns); 3165 3165 my $bkfields = q(b.backup_id AS hasbk, b.bkbrand, b.bkmodel, b.bktype, b.bkport, b.bksrc, 3166 3166 b.bkuser, b.bkvpass, b.bkepass, b.bkip); … … 3168 3168 if ($type eq 'i') { 3169 3169 my $binfo = $dbh->selectrow_hashref(qq( 3170 SELECT p.id, p.ip AS block, p.city, p.vrf, p.parent_id, p.master_id, $commonfields, 3171 d.zone >> p.ip AS revavail, 3172 $bkfields 3173 FROM poolips p 3174 LEFT JOIN dnsavail d ON p.master_id = d.parent_alloc AND p.ip << d.zone 3175 LEFT JOIN backuplist b ON p.backup_id = b.backup_id 3176 WHERE id = ? 3170 SELECT a.id, a.ip AS block, a.city, a.vrf, a.parent_id, a.master_id, $commonfields, 3171 d.zone >> a.ip AS revavail, 3172 $bkfields, 3173 v.location 3174 FROM poolips a 3175 LEFT JOIN dnsavail d ON a.master_id = d.parent_alloc AND a.ip << d.zone 3176 LEFT JOIN backuplist b ON a.backup_id = b.backup_id 3177 JOIN allocations m ON a.master_id = m.id JOIN vrfs v ON m.vrf = v.vrf 3178 WHERE a.id = ? 3177 3179 ), undef, ($id) ); 3178 3180 return $binfo; 3179 3181 } else { 3180 3182 my $binfo = $dbh->selectrow_hashref(qq( 3181 SELECT a.id, a.cidr AS block, a.city, a.vrf, a.parent_id, a.master_id, swip, $commonfields,3183 SELECT a.id, a.cidr AS block, a.city, a.vrf, a.parent_id, a.master_id, a.swip, $commonfields, 3182 3184 f.cidr AS reserve, f.id as reserve_id, 3183 3185 d.zone >>= a.cidr AS revavail, d.zone << a.cidr AS revpartial, 3184 $bkfields 3186 $bkfields, 3187 v.location 3185 3188 FROM allocations a 3186 3189 LEFT JOIN freeblocks f ON a.id=f.reserve_for 3187 3190 LEFT JOIN dnsavail d ON a.master_id = d.parent_alloc AND (a.cidr <<= d.zone OR a.cidr >> d.zone) 3188 3191 LEFT JOIN backuplist b ON a.backup_id = b.backup_id 3192 JOIN allocations m ON a.master_id = m.id JOIN vrfs v ON m.vrf = v.vrf 3189 3193 WHERE a.id = ? 3190 3194 ), undef, ($id) );
Note:
See TracChangeset
for help on using the changeset viewer.