Trying to fix MySQL server has gone away, thx for all the hints and help - let us hope it works, ref #1025

Signed-off-by: Florian Aders (EleRas) <eleras@froxlor.org>
This commit is contained in:
Florian Aders (EleRas)
2012-02-27 20:47:05 +01:00
parent 4297ed3607
commit aa7cf38f7e
6 changed files with 19 additions and 19 deletions

View File

@@ -29,56 +29,56 @@ class db
* @var int
*/
var $link_id = 0;
public $link_id = 0;
/**
* Query ID for every query
* @var int
*/
var $query_id = 0;
private $query_id = 0;
/**
* Errordescription, if an error occures
* @var string
*/
var $errdesc = '';
public $errdesc = '';
/**
* Errornumber, if an error occures
* @var int
*/
var $errno = 0;
public $errno = 0;
/**
* Servername
* @var string
*/
var $server = '';
private $server = '';
/**
* Username
* @var string
*/
var $user = '';
private $user = '';
/**
* Password
* @var string
*/
var $password = '';
private $password = '';
/**
* Database
* @var string
*/
var $database = '';
private $database = '';
/**
* Class constructor. Connects to Databaseserver and selects Database
@@ -188,8 +188,19 @@ class db
function query($query_str, $unbuffered = false, $suppress_error = false)
{
global $numbqueries;
if (!mysql_ping($this->link_id))
{
$this->link_id = mysql_connect($this->server,$this->user,$this->password);
if(!$this->database)
{
return false;
}
mysql_select_db($this->database);
}
if(!$unbuffered)
{
if($suppress_error)

View File

@@ -155,7 +155,6 @@ if($db->link_id == 0)
fwrite($debugHandler, 'Database-connection established' . "\n");
unset($sql);
unset($db->password);
$result = $db->query("SELECT `settingid`, `settinggroup`, `varname`, `value` FROM `" . TABLE_PANEL_SETTINGS . "`");
while($row = $db->fetch_array($result))

View File

@@ -58,7 +58,6 @@ function openRootDB($debugHandler = false, $lockfile = false)
die('root can\'t connect to mysqlserver. Please check userdata.inc.php! Exiting...');
}
unset($db_root->password);
if(isset($debugHandler) && $debugHandler !== false)
{
fwrite($debugHandler, 'Database-rootconnection established' . "\n");

View File

@@ -117,7 +117,6 @@ require ('./lib/tables.inc.php');
$db = new db($sql['host'], $sql['user'], $sql['password'], $sql['db']);
unset($sql['password']);
unset($db->password);
// we will try to unset most of the $sql information if they are not needed
// by the calling script.