Qual: Moved duplicate methods to base method
This commit is contained in:
parent
5cbb1dd96d
commit
16ede7c52c
@ -125,6 +125,55 @@ abstract class DoliDB implements Database
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate a database transaction
|
||||||
|
*
|
||||||
|
* @param string $log Add more log to default log line
|
||||||
|
* @return int 1 if validation is OK or transaction level no started, 0 if ERROR
|
||||||
|
*/
|
||||||
|
function commit($log='')
|
||||||
|
{
|
||||||
|
dol_syslog('',0,-1);
|
||||||
|
if ($this->transaction_opened<=1)
|
||||||
|
{
|
||||||
|
$ret=$this->query("COMMIT");
|
||||||
|
if ($ret)
|
||||||
|
{
|
||||||
|
$this->transaction_opened=0;
|
||||||
|
dol_syslog("COMMIT Transaction".($log?' '.$log:''),LOG_DEBUG);
|
||||||
|
}
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->transaction_opened--;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Annulation d'une transaction et retour aux anciennes valeurs
|
||||||
|
*
|
||||||
|
* @param string $log Add more log to default log line
|
||||||
|
* @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
|
||||||
|
*/
|
||||||
|
function rollback($log='')
|
||||||
|
{
|
||||||
|
dol_syslog('',0,-1);
|
||||||
|
if ($this->transaction_opened<=1)
|
||||||
|
{
|
||||||
|
$ret=$this->query("ROLLBACK");
|
||||||
|
$this->transaction_opened=0;
|
||||||
|
dol_syslog("ROLLBACK Transaction".($log?' '.$log:''),LOG_DEBUG);
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->transaction_opened--;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return version of database server into an array
|
* Return version of database server into an array
|
||||||
*
|
*
|
||||||
|
|||||||
@ -239,55 +239,6 @@ class DoliDBMysql extends DoliDB
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Validate a database transaction
|
|
||||||
*
|
|
||||||
* @param string $log Add more log to default log line
|
|
||||||
* @return int 1 if validation is OK or transaction level no started, 0 if ERROR
|
|
||||||
*/
|
|
||||||
function commit($log='')
|
|
||||||
{
|
|
||||||
dol_syslog('',0,-1);
|
|
||||||
if ($this->transaction_opened<=1)
|
|
||||||
{
|
|
||||||
$ret=$this->query("COMMIT");
|
|
||||||
if ($ret)
|
|
||||||
{
|
|
||||||
$this->transaction_opened=0;
|
|
||||||
dol_syslog("COMMIT Transaction".($log?' '.$log:''),LOG_DEBUG);
|
|
||||||
}
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->transaction_opened--;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Annulation d'une transaction et retour aux anciennes valeurs
|
|
||||||
*
|
|
||||||
* @param string $log Add more log to default log line
|
|
||||||
* @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
|
|
||||||
*/
|
|
||||||
function rollback($log='')
|
|
||||||
{
|
|
||||||
dol_syslog('',0,-1);
|
|
||||||
if ($this->transaction_opened<=1)
|
|
||||||
{
|
|
||||||
$ret=$this->query("ROLLBACK");
|
|
||||||
$this->transaction_opened=0;
|
|
||||||
dol_syslog("ROLLBACK Transaction".($log?' '.$log:''),LOG_DEBUG);
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->transaction_opened--;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute a SQL request and return the resultset
|
* Execute a SQL request and return the resultset
|
||||||
*
|
*
|
||||||
|
|||||||
@ -243,55 +243,6 @@ class DoliDBMysqli extends DoliDB
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Validate a database transaction
|
|
||||||
*
|
|
||||||
* @param string $log Add more log to default log line
|
|
||||||
* @return int 1 if validation is OK or transaction level no started, 0 if ERROR
|
|
||||||
*/
|
|
||||||
function commit($log='')
|
|
||||||
{
|
|
||||||
dol_syslog('',0,-1);
|
|
||||||
if ($this->transaction_opened<=1)
|
|
||||||
{
|
|
||||||
$ret=$this->query("COMMIT");
|
|
||||||
if ($ret)
|
|
||||||
{
|
|
||||||
$this->transaction_opened=0;
|
|
||||||
dol_syslog("COMMIT Transaction".($log?' '.$log:''),LOG_DEBUG);
|
|
||||||
}
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->transaction_opened--;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Annulation d'une transaction et retour aux anciennes valeurs
|
|
||||||
*
|
|
||||||
* @param string $log Add more log to default log line
|
|
||||||
* @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
|
|
||||||
*/
|
|
||||||
function rollback($log='')
|
|
||||||
{
|
|
||||||
dol_syslog('',0,-1);
|
|
||||||
if ($this->transaction_opened<=1)
|
|
||||||
{
|
|
||||||
$ret=$this->query("ROLLBACK");
|
|
||||||
$this->transaction_opened=0;
|
|
||||||
dol_syslog("ROLLBACK Transaction".($log?' '.$log:''),LOG_DEBUG);
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->transaction_opened--;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute a SQL request and return the resultset
|
* Execute a SQL request and return the resultset
|
||||||
*
|
*
|
||||||
|
|||||||
@ -448,56 +448,6 @@ class DoliDBPgsql extends DoliDB
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Validate a database transaction
|
|
||||||
*
|
|
||||||
* @param string $log Add more log to default log line
|
|
||||||
* @return int 1 if validation is OK or transaction level no started, 0 if ERROR
|
|
||||||
*/
|
|
||||||
function commit($log='')
|
|
||||||
{
|
|
||||||
dol_syslog('',0,-1);
|
|
||||||
if ($this->transaction_opened<=1)
|
|
||||||
{
|
|
||||||
$ret=$this->query("COMMIT;");
|
|
||||||
if ($ret)
|
|
||||||
{
|
|
||||||
$this->transaction_opened=0;
|
|
||||||
dol_syslog("COMMIT Transaction",LOG_DEBUG);
|
|
||||||
}
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->transaction_opened--;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Annulation d'une transaction et retour aux anciennes valeurs
|
|
||||||
*
|
|
||||||
* @param string $log Add more log to default log line
|
|
||||||
* @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
|
|
||||||
*/
|
|
||||||
function rollback($log='')
|
|
||||||
{
|
|
||||||
dol_syslog('',0,-1);
|
|
||||||
if ($this->transaction_opened<=1)
|
|
||||||
{
|
|
||||||
$ret=$this->query("ROLLBACK;");
|
|
||||||
$this->transaction_opened=0;
|
|
||||||
dol_syslog("ROLLBACK Transaction".($log?' '.$log:''),LOG_DEBUG);
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->transaction_opened--;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert request to PostgreSQL syntax, execute it and return the resultset
|
* Convert request to PostgreSQL syntax, execute it and return the resultset
|
||||||
*
|
*
|
||||||
|
|||||||
@ -368,55 +368,6 @@ class DoliDBSqlite extends DoliDB
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Validate a database transaction
|
|
||||||
*
|
|
||||||
* @param string $log Add more log to default log line
|
|
||||||
* @return int 1 if validation is OK or transaction level no started, 0 if ERROR
|
|
||||||
*/
|
|
||||||
function commit($log='')
|
|
||||||
{
|
|
||||||
dol_syslog('',0,-1);
|
|
||||||
if ($this->transaction_opened<=1)
|
|
||||||
{
|
|
||||||
$ret=$this->query("COMMIT");
|
|
||||||
if ($ret)
|
|
||||||
{
|
|
||||||
$this->transaction_opened=0;
|
|
||||||
dol_syslog("COMMIT Transaction".($log?' '.$log:''),LOG_DEBUG);
|
|
||||||
}
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->transaction_opened--;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Annulation d'une transaction et retour aux anciennes valeurs
|
|
||||||
*
|
|
||||||
* @param string $log Add more log to default log line
|
|
||||||
* @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
|
|
||||||
*/
|
|
||||||
function rollback($log='')
|
|
||||||
{
|
|
||||||
dol_syslog('',0,-1);
|
|
||||||
if ($this->transaction_opened<=1)
|
|
||||||
{
|
|
||||||
$ret=$this->query("ROLLBACK");
|
|
||||||
$this->transaction_opened=0;
|
|
||||||
dol_syslog("ROLLBACK Transaction".($log?' '.$log:''),LOG_DEBUG);
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->transaction_opened--;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute a SQL request and return the resultset
|
* Execute a SQL request and return the resultset
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user