Add compress flag when connecting with mysql
This commit is contained in:
parent
406dff7629
commit
ab819c5c6e
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
class WDB {
|
||||
|
||||
|
||||
private $host;
|
||||
private $database;
|
||||
private $user;
|
||||
@ -10,7 +10,7 @@ class WDB {
|
||||
private $result;
|
||||
|
||||
public function __construct($database='', $host='', $user='', $password='') {
|
||||
|
||||
|
||||
if ($host=='') $this->host=MYSQL_HOST;
|
||||
else $this->host=$host;
|
||||
if ($user=='') $this->user=MYSQL_USER;
|
||||
@ -19,11 +19,14 @@ class WDB {
|
||||
else $this->password=$password;
|
||||
if ($database=='') $this->database=MYSQL_DEFAULT_DB;
|
||||
else $this->database=$database;
|
||||
|
||||
|
||||
//if (defined(MYSQL_PORT)) $this->host = $this->host.':'.MYSQL_PORT;
|
||||
$this->host = $this->host.':53336';
|
||||
|
||||
$this->con_id = mysql_connect($this->host, $this->user, $this->password);
|
||||
|
||||
//Server is far away try to compress data
|
||||
$flags = MYSQL_CLIENT_COMPRESS;
|
||||
|
||||
$this->con_id = mysql_connect($this->host, $this->user, $this->password, false, $flags);
|
||||
if (!($this->con_id === false)) {
|
||||
if (mysql_select_db($this->database, $this->con_id) === false) {
|
||||
echo date('Y/m/d - H:i:s') ." - ERREUR ".mysql_errno()." : Connection à la base de données impossible !".EOL;
|
||||
@ -56,7 +59,7 @@ public function insert($table, $toAdd, $debug=false, $low_priority=false){
|
||||
|
||||
$values = "'".implode(array_values($tmp), "','")."'"; # better
|
||||
$values = str_replace("'NULL'", 'NULL', $values);
|
||||
|
||||
|
||||
if ($low_priority)
|
||||
$query = 'INSERT DELAYED INTO `'.$table.'` (`'.$fields.'`) VALUES ('.$values.');';
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user