tbrehm
2010-02-10 d0fc019d7f82d6befe47ea345886223db1101fe3
server/lib/classes/db_mysql.inc.php
@@ -41,7 +41,7 @@
      var $errorNumber = 0;   // last error number
      var $errorMessage = "";   // last error message
      var $errorLocation = "";// last error location
      var $show_error_messages = false;
      var $show_error_messages = true;
      // constructor
      function db()
@@ -52,19 +52,22 @@
         $this->dbName = $conf["db_database"];
         $this->dbUser = $conf["db_user"];
         $this->dbPass = $conf["db_password"];
         $this->dbCharset = $conf['db_charset'];
         //$this->connect();
      }
      // error handler
      function updateError($location)
      {
         $this->errorNumber = mysql_errno();
         $this->errorMessage = mysql_error();
         global $app;
         $this->errorNumber = mysql_errno($this->linkId);
         $this->errorMessage = mysql_error($this->linkId);
         $this->errorLocation = $location;
         if($this->errorNumber && $this->show_error_messages)
         if($this->errorNumber && $this->show_error_messages && method_exists($app,'log'))
         {
            echo('<br /><b>'.$this->errorLocation.'</b><br />'.$this->errorMessage);
            flush();
            // echo('<br /><b>'.$this->errorLocation.'</b><br />'.$this->errorMessage);
            $app->log($this->errorLocation." ".$this->errorMessage,LOGLEVEL_WARN);
            //flush();
         }
      }
@@ -75,9 +78,11 @@
            $this->linkId = mysql_connect($this->dbHost, $this->dbUser, $this->dbPass);
            if(!$this->linkId)
            {
               $this->updateError('DB::connect()<br />mysql_connect');
               $this->updateError('DB::connect()-> mysql_connect');
               return false;
            }
            $this->queryId = @mysql_query('SET NAMES '.$this->dbCharset, $this->linkId);
            $this->queryId = @mysql_query("SET character_set_results = '".$this->dbCharset."', character_set_client = '".$this->dbCharset."', character_set_connection = '".$this->dbCharset."', character_set_database = '".$this->dbCharset."', character_set_server = '".$this->dbCharset."'", $this->linkId);
         }
         return true;
      }
@@ -90,11 +95,11 @@
         }
         if(!mysql_select_db($this->dbName, $this->linkId))
         {
            $this->updateError('DB::connect()<br />mysql_select_db');
            $this->updateError('DB::connect()-> mysql_select_db');
            return false;
         }
         $this->queryId = @mysql_query($queryString, $this->linkId);
         $this->updateError('DB::query('.$queryString.')<br />mysql_query');
         $this->updateError('DB::query('.$queryString.') -> mysql_query');
         if(!$this->queryId)
         {
            return false;
@@ -132,7 +137,7 @@
      function nextRecord()
      {
            $this->record = mysql_fetch_assoc($this->queryId);
         $this->updateError('DB::nextRecord()<br />mysql_fetch_array');
         $this->updateError('DB::nextRecord()-> mysql_fetch_array');
         if(!$this->record || !is_array($this->record))
         {
            return false;
@@ -187,7 +192,8 @@
      return $out;
      }
       
       /*
      //* These functions are deprecated and will be removed.
       function insert($tablename,$form,$debug = 0)
       {
         if(is_array($form)){
@@ -222,6 +228,7 @@
             if($debug == 1) echo "mySQL Error Message: ".$this->errorMessage;
           }
       }
      */
       
       public function closeConn()
       {