Ignore:
Timestamp:
03/29/13 17:15:20 (11 years ago)
Author:
ramonb
Message:
  • more fixes to search
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/0.4/web/addons/job_monarch/libtoga.php

    r767 r778  
    9797global $JOB_ARCHIVE_DIR;
    9898global $JOB_ARCHIVE_DBASE;
     99global $JOB_ARCHIVE_SQL_USER;
     100global $JOB_ARCHIVE_SQL_PASSWORD;
    99101global $skan_str;
    100102global $x_first, $y_first;
     
    160162    var $ip, $dbase, $conn;
    161163
    162     function TarchDbase( $ip = null, $dbase = null )
     164    function TarchDbase( $ip = null, $dbase = null, $user =null, $password=null )
    163165    {
    164166        global $CLUSTER_CONFS, $clustername;
     
    184186    function connect()
    185187    {
     188        global $JOB_ARCHIVE_SQL_USER, $JOB_ARCHIVE_SQL_PASSWORD;
     189
     190        $connect_args ='';
    186191        if( $this->ip == null )
    187             $this->conn = pg_connect( "dbname=".$this->dbase );
     192        {
     193            $connect_args .= "dbname=".$this->dbase;
     194        }
    188195        else
    189             $this->conn = pg_connect( "host=".$this->ip." dbname=".$this->dbase );
     196        {
     197            $connect_args .= "host=".$this->ip." dbname=".$this->dbase;
     198        }
     199        if( isset($JOB_ARCHIVE_SQL_USER) )
     200        {
     201            $connect_args .= " user=".$JOB_ARCHIVE_SQL_USER;
     202        }
     203        if( isset($JOB_ARCHIVE_SQL_PASSWORD) )
     204        {
     205            $connect_args .= " password=".$JOB_ARCHIVE_SQL_PASSWORD;
     206        }
     207
     208
     209        $this->conn = pg_connect( $connect_args );
     210
    190211    }
    191212
     
    260281
    261282        $ids = $this->queryDbase( $select_query );
     283
     284        //print_r( $ids );
    262285
    263286        $ret = array();
     
    335358    {
    336359        $result_rows = array();
    337     
    338         if( !$this->conn )
     360   
     361        if( $this->conn == null )
    339362        {
    340363            $this->connect();
    341364        }
    342365
     366        if( $this->conn == null )
     367        {
     368            printf(" no connection!\n");
     369        }
    343370        $result = pg_query( $this->conn, $query );
    344371
    345372        while ($row = pg_fetch_assoc($result))
    346373        {
     374            //print_r( $row );
    347375            $result_rows[] = $row;
    348376        }
Note: See TracChangeset for help on using the changeset viewer.