mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-07 16:41:48 +01:00
Merge remote-tracking branch 'origin/3.6' into 3.7
Conflicts: ChangeLog htdocs/comm/fiche.php htdocs/core/lib/functions2.lib.php htdocs/fourn/fiche.php htdocs/langs/fr_FR/compta.lang htdocs/projet/element.php htdocs/projet/tasks/contact.php htdocs/projet/tasks/time.php
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001 Fabien Seisen <seisen@linuxfr.org>
|
||||
* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
@@ -37,13 +37,13 @@ class DoliDBPgsql extends DoliDB
|
||||
//! Database type
|
||||
public $type='pgsql'; // Name of manager
|
||||
//! Database label
|
||||
static $label='PostgreSQL'; // Label of manager
|
||||
const LABEL='PostgreSQL'; // Label of manager
|
||||
//! Charset
|
||||
var $forcecharset='UTF8'; // Can't be static as it may be forced with a dynamic value
|
||||
//! Collate used to force collate when creating database
|
||||
var $forcecollate=''; // Can't be static as it may be forced with a dynamic value
|
||||
//! Version min database
|
||||
static $versionmin=array(8,4,0); // Version min database
|
||||
const VERSIONMIN='8.4.0'; // Version min database
|
||||
//! Resultset of last query
|
||||
private $_results;
|
||||
|
||||
@@ -71,6 +71,8 @@ class DoliDBPgsql extends DoliDB
|
||||
if (! empty($conf->db->dolibarr_main_db_collation)) $this->forcecollate=$conf->db->dolibarr_main_db_collation;
|
||||
|
||||
$this->database_user=$user;
|
||||
$this->database_host=$host;
|
||||
$this->database_port=$port;
|
||||
|
||||
$this->transaction_opened=0;
|
||||
|
||||
@@ -494,7 +496,10 @@ class DoliDBPgsql extends DoliDB
|
||||
@pg_query($this->db, 'SAVEPOINT mysavepoint');
|
||||
}
|
||||
|
||||
if (! in_array($query,array('BEGIN','COMMIT','ROLLBACK'))) dol_syslog('sql='.$query, LOG_DEBUG);
|
||||
|
||||
$ret = @pg_query($this->db, $query);
|
||||
|
||||
//print $query;
|
||||
if (! preg_match("/^COMMIT/i",$query) && ! preg_match("/^ROLLBACK/i",$query)) // Si requete utilisateur, on la sauvegarde ainsi que son resultset
|
||||
{
|
||||
@@ -506,9 +511,10 @@ class DoliDBPgsql extends DoliDB
|
||||
$this->lasterror = $this->error();
|
||||
$this->lasterrno = $this->errno();
|
||||
}
|
||||
dol_syslog(get_class($this)."::query SQL error usesavepoint = ".$usesavepoint." - ".$query." - ".pg_last_error($this->db)." => ".$this->errno(), LOG_WARNING);
|
||||
//print "\n>> ".$query."<br>\n";
|
||||
//print '>> '.$this->lasterrno.' - '.$this->lasterror.' - '.$this->lastqueryerror."<br>\n";
|
||||
|
||||
dol_syslog(get_class($this)."::query SQL Error query: ".$query, LOG_ERR);
|
||||
dol_syslog(get_class($this)."::query SQL Error message: ".$this->lasterror." (".$this->lasterrno.")", LOG_ERR);
|
||||
dol_syslog(get_class($this)."::query SQL error usesavepoint = ".$usesavepoint, LOG_ERR);
|
||||
|
||||
if ($usesavepoint && $this->transaction_opened) // Warning, after that errno will be erased
|
||||
{
|
||||
@@ -663,7 +669,7 @@ class DoliDBPgsql extends DoliDB
|
||||
/**
|
||||
* Renvoie le code erreur generique de l'operation precedente.
|
||||
*
|
||||
* @return error_num (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...)
|
||||
* @return string Error code (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...)
|
||||
*/
|
||||
function errno()
|
||||
{
|
||||
@@ -729,7 +735,7 @@ class DoliDBPgsql extends DoliDB
|
||||
/**
|
||||
* Renvoie le texte de l'erreur pgsql de l'operation precedente
|
||||
*
|
||||
* @return error_text
|
||||
* @return string Error text
|
||||
*/
|
||||
function error()
|
||||
{
|
||||
@@ -842,8 +848,8 @@ class DoliDBPgsql extends DoliDB
|
||||
* List tables into a database
|
||||
*
|
||||
* @param string $database Name of database
|
||||
* @param string $table Nmae of table filter ('xxx%')
|
||||
* @return resource Resource
|
||||
* @param string $table Name of table filter ('xxx%')
|
||||
* @return array List of tables in an array
|
||||
*/
|
||||
function DDLListTables($database, $table='')
|
||||
{
|
||||
@@ -856,7 +862,7 @@ class DoliDBPgsql extends DoliDB
|
||||
{
|
||||
$listtables[] = $row[0];
|
||||
}
|
||||
return $listtables;
|
||||
return $listtables;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1205,11 +1211,14 @@ class DoliDBPgsql extends DoliDB
|
||||
*/
|
||||
function getPathOfRestore()
|
||||
{
|
||||
$fullpathofdump='/pathtopgrestore/pg_restore';
|
||||
//$tool='pg_restore';
|
||||
$tool='psql';
|
||||
|
||||
if (file_exists('/usr/bin/pg_restore'))
|
||||
$fullpathofdump='/pathtopgrestore/'.$tool;
|
||||
|
||||
if (file_exists('/usr/bin/'.$tool))
|
||||
{
|
||||
$fullpathofdump='/usr/bin/pg_restore';
|
||||
$fullpathofdump='/usr/bin/'.$tool;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1219,7 +1228,7 @@ class DoliDBPgsql extends DoliDB
|
||||
{
|
||||
$liste=$this->fetch_array($resql);
|
||||
$basedir=$liste['data_directory'];
|
||||
$fullpathofdump=preg_replace('/data$/','bin',$basedir).'/pg_restore';
|
||||
$fullpathofdump=preg_replace('/data$/','bin',$basedir).'/'.$tool;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user