Changeset 5299b95492a1e76085ae34cf08f96ba288e9b86f

Show
Ignore:
Timestamp:
07/12/08 22:08:02 (6 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1215900482 +0000
git-parent:

[356779758e509ee0f1a2f419e9fab1d48fdc3c33]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1215900482 +0000
Message:

not quite as simple as I had expected. This works though.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • ui/web/lib/Reconnoiter_DB.php

    r5b508a1 r5299b95  
    6464    $vars = $this->valid_source_variables(); 
    6565    if(!in_array($want, $vars)) return array(); 
     66    $tblsrc = ($want == 'metric_name') ? 'm' : 'c'; 
    6667    $binds = array(); 
    6768    $named_binds = array(); 
     
    6970    foreach($vars as $var) { 
    7071      if(isset($fixate[$var])) { 
    71         $where_sql .= " and c.$var = ?"; 
     72        $fix_tblsrc = ($var == 'metric_name') ? 'm' : 'c'; 
     73        $where_sql .= " and $fix_tblsrc.$var = ?"; 
    7274        $binds[] = $fixate[$var]; 
    7375        $named_binds[$var] = $fixate[$var]; 
     
    8284      $ptr_join = " 
    8385        left join stratcon.mv_loading_dock_check_s cia 
    84                on (    c.$want ::inet = cia.target ::inet 
     86               on (    $tblsrc.$want ::inet = cia.target ::inet 
    8587                   and cia.module='dns' and cia.name='in-addr.arpa') 
    8688        left join stratcon.current_metric_text ciamt 
     
    8890    } 
    8991    $sql = " 
    90       select c.$want, $ptr_select 
     92      select $tblsrc.$want, $ptr_select 
    9193             min(c.sid) as sid, min(metric_type) as metric_type, 
    9294             count(1) as cnt 
     
    9597             $ptr_join 
    9698       where active = " . ($active ? "true" : "false") . $where_sql . " 
    97     group by c.$want $ptr_groupby 
    98     order by c.$want"; 
     99    group by $tblsrc.$want $ptr_groupby 
     100    order by $tblsrc.$want"; 
    99101    $sth = $this->db->prepare($sql); 
    100102    $sth->execute($binds);