Show
Ignore:
Timestamp:
10/04/06 12:18:19 (2 years ago)
Author:
cfriesen
Message:

Fix for #446

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/gregarius/cls/db/db.mysql.php

    r1181 r1596  
    3131class MysqlDB extends DB { 
    3232 
     33    var $resource; 
     34 
    3335    function  MysqlDB() { 
    3436        parent::DB(); 
     
    4143     
    4244    function DBConnect($dbserver, $dbuname, $dbpass) { 
    43          if (!mysql_connect($dbserver, $dbuname, $dbpass)) { 
     45    $this -> resource = mysql_connect($dbserver, $dbuname, $dbpass); 
     46 
     47        if(!$this -> resource) { 
    4448              die( "<h1>Error connecting to the database!</h1>\n" 
    4549                     ."<p>Have you edited dbinit.php and correctly defined " 
     
    4953     
    5054    function DBSelectDB($dbname) { 
    51         if (!mysql_select_db($dbname)) { 
     55        if (!mysql_select_db($dbname, $this -> resource)) { 
    5256              die( "<h1>Error selecting the database!</h1>\n" 
    5357                     ."<p>Does your database exist?" 
     
    6064     
    6165    function rss_query ($query, $dieOnError=true, $preventRecursion=false) { 
    62          $ret =  mysql_query($query); 
     66         $ret =  mysql_query($query, $this -> resource); 
    6367     
    6468         if ($error = $this -> rss_sql_error()) { 
     
    101105     
    102106    function rss_sql_error() { 
    103          return mysql_errno(); 
     107         return mysql_errno($this -> resource); 
    104108    } 
    105109     
    106110    function rss_sql_error_message () { 
    107          return mysql_error(); 
     111         return mysql_error($this -> resource); 
    108112    } 
    109113     
    110114    function rss_insert_id() { 
    111         return mysql_insert_id(); 
     115        return mysql_insert_id($this -> resource); 
    112116    } 
    113117     
     
    125129        switch ($kind) { 
    126130            case RSS_SQL_ERROR_NO_ERROR: 
    127                 return (mysql_errno() == 0); 
     131                return (mysql_errno($this -> resource) == 0); 
    128132                break; 
    129133            case RSS_SQL_ERROR_DUPLICATE_ROW: 
    130                 return (mysql_errno() == 1062); 
     134                return (mysql_errno($this -> resource) == 1062); 
    131135                break; 
    132136            default: