Changeset 778 for branches/0.4/web/addons/job_monarch/libtoga.php
- Timestamp:
- 03/29/13 17:15:20 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/0.4/web/addons/job_monarch/libtoga.php
r767 r778 97 97 global $JOB_ARCHIVE_DIR; 98 98 global $JOB_ARCHIVE_DBASE; 99 global $JOB_ARCHIVE_SQL_USER; 100 global $JOB_ARCHIVE_SQL_PASSWORD; 99 101 global $skan_str; 100 102 global $x_first, $y_first; … … 160 162 var $ip, $dbase, $conn; 161 163 162 function TarchDbase( $ip = null, $dbase = null )164 function TarchDbase( $ip = null, $dbase = null, $user =null, $password=null ) 163 165 { 164 166 global $CLUSTER_CONFS, $clustername; … … 184 186 function connect() 185 187 { 188 global $JOB_ARCHIVE_SQL_USER, $JOB_ARCHIVE_SQL_PASSWORD; 189 190 $connect_args =''; 186 191 if( $this->ip == null ) 187 $this->conn = pg_connect( "dbname=".$this->dbase ); 192 { 193 $connect_args .= "dbname=".$this->dbase; 194 } 188 195 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 190 211 } 191 212 … … 260 281 261 282 $ids = $this->queryDbase( $select_query ); 283 284 //print_r( $ids ); 262 285 263 286 $ret = array(); … … 335 358 { 336 359 $result_rows = array(); 337 338 if( !$this->conn)360 361 if( $this->conn == null ) 339 362 { 340 363 $this->connect(); 341 364 } 342 365 366 if( $this->conn == null ) 367 { 368 printf(" no connection!\n"); 369 } 343 370 $result = pg_query( $this->conn, $query ); 344 371 345 372 while ($row = pg_fetch_assoc($result)) 346 373 { 374 //print_r( $row ); 347 375 $result_rows[] = $row; 348 376 }
Note: See TracChangeset
for help on using the changeset viewer.