From f4038a2160d55a7f519a3b42be1aa96e29e9a908 Mon Sep 17 00:00:00 2001
From: ftimme <ft@falkotimme.com>
Date: Wed, 27 Feb 2013 09:01:40 -0500
Subject: [PATCH] - Fixed "FUNCTION databasename.CONCAT does not exist" error for older MySQL versions.

---
 interface/lib/classes/db_mysql.inc.php |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/interface/lib/classes/db_mysql.inc.php b/interface/lib/classes/db_mysql.inc.php
index 01eae1b..085eb54 100644
--- a/interface/lib/classes/db_mysql.inc.php
+++ b/interface/lib/classes/db_mysql.inc.php
@@ -60,7 +60,8 @@
     $this->dbClientFlags = $conf[$prefix.'db_client_flags'];
     parent::__construct($conf[$prefix.'db_host'], $conf[$prefix.'db_user'],$conf[$prefix.'db_password'],$conf[$prefix.'db_database']);
     $try = 0;
-    while(!is_null($this->connect_error) && $try < 5) {
+    //while(!is_null($this->connect_error) && $try < 5) {
+	while(mysqli_connect_error() && $try < 5) {
       if($try > 0) sleep(1);
       
       $try++;
@@ -69,7 +70,9 @@
       parent::__construct($conf[$prefix.'db_host'], $conf[$prefix.'db_user'],$conf[$prefix.'db_password'],$conf[$prefix.'db_database']);
     }
     
-    if(is_null($this->connect_error)) $this->isConnected = true;
+    //if(is_null($this->connect_error)) $this->isConnected = true;
+    //else return false;
+	if(!mysqli_connect_error()) $this->isConnected = true;
     else return false;
     
     $this->setCharacterEncoding();
@@ -83,6 +86,7 @@
   public function updateError($location) {
     global $app;
 
+	/*
     if(!is_null($this->connect_error)) {
       $this->errorNumber = $this->connect_errno;
       $this->errorMessage = $this->connect_error;
@@ -90,6 +94,15 @@
       $this->errorNumber = $this->errno;
       $this->errorMessage = $this->error;
     }
+	*/
+	if(mysqli_connect_error()) {
+      $this->errorNumber = mysqli_connect_errno();
+      $this->errorMessage = mysqli_connect_error();
+    } else {
+      $this->errorNumber = mysqli_errno($this);
+      $this->errorMessage = mysqli_error($this);
+    }
+
 
     $this->errorLocation = $location;
     if($this->errorNumber) {

--
Gitblit v1.9.1