Enhancement for postgresql support

This commit is contained in:
Laurent Destailleur 2010-04-30 18:00:39 +00:00
parent 054572fa12
commit 22382756d1
3 changed files with 17 additions and 12 deletions

View File

@ -161,7 +161,7 @@ INSERT INTO `llx_c_field_list` (`rowid`, `element`, `entity`, `name`, `alias`, `
(8, 'product_default', 1, 'p.envente', 'status', 'Status', 'right', 1, 0, '1', 8);
UPDATE llx_adherent SET pays = null where pays <= 0 and pays != '0';
UPDATE llx_adherent SET pays = null where pays <= '0' and pays != '0';
ALTER table llx_adherent MODIFY pays integer;
-- add milestone module

View File

@ -224,9 +224,9 @@ if (! isset($_GET["action"]) || preg_match('/upgrade/i',$_GET["action"]))
}
/*
* Remove deprecated indexes and constraints
* Remove deprecated indexes and constraints for Mysql
*/
if ($ok)
if ($ok && preg_match('/mysql/',$db->type))
{
$versioncommande=explode('.','4.0');
if (sizeof($versioncommande) && sizeof($versionarray)
@ -279,9 +279,7 @@ if (! isset($_GET["action"]) || preg_match('/upgrade/i',$_GET["action"]))
*/
if ($ok)
{
if ($choix==1) $dir = "mysql/migration/";
elseif ($choix==2) $dir = "pgsql/migration/";
else $dir = "mssql/migration/";
$dir = "mysql/migration/"; // We use mysql migration scripts whatever is database driver
$filelist=array();
$i = 0;
@ -292,11 +290,18 @@ if (! isset($_GET["action"]) || preg_match('/upgrade/i',$_GET["action"]))
# Recupere list fichier
$filesindir=array();
$handle=opendir($dir);
while (($file = readdir($handle))!==false)
if ($handle)
{
if (preg_match('/\.sql$/i',$file)) $filesindir[]=$file;
while (($file = readdir($handle))!==false)
{
if (preg_match('/\.sql$/i',$file)) $filesindir[]=$file;
}
sort($filesindir);
}
else
{
print '<div class="error">'.$langs->trans("ErrorCanNotReadDir",$dir).'</div>';
}
sort($filesindir);
# Define which file to run
foreach($filesindir as $file)

View File

@ -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-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2010 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-2009 Regis Houssin <regis@dolibarr.fr>
@ -479,7 +479,7 @@ class DoliDb
else $loop=false;
}
if ($usesavepoint)
if ($usesavepoint && $this->transaction_opened)
{
@pg_query($this->db, 'SAVEPOINT mysavepoint');
}
@ -497,7 +497,7 @@ class DoliDb
//print "\n>> ".$query."<br>\n";
//print '>> '.$this->lasterrno.' - '.$this->lasterror.' - '.$this->lastqueryerror."<br>\n";
if ($usesavepoint)
if ($usesavepoint && $this->transaction_opened)
{
@pg_query($this->db, 'ROLLBACK TO SAVEPOINT mysavepoint');
}