Database: factorized begin()
This commit is contained in:
parent
739a566156
commit
f91e2ec7b2
@ -99,6 +99,32 @@ abstract class DoliDB implements Database
|
||||
return $this->lasterrno;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start transaction
|
||||
*
|
||||
* @return int 1 if transaction successfuly opened or already opened, 0 if error
|
||||
*/
|
||||
function begin()
|
||||
{
|
||||
if (! $this->transaction_opened)
|
||||
{
|
||||
$ret=$this->query("BEGIN");
|
||||
if ($ret)
|
||||
{
|
||||
$this->transaction_opened++;
|
||||
dol_syslog("BEGIN Transaction",LOG_DEBUG);
|
||||
dol_syslog('',0,1);
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->transaction_opened++;
|
||||
dol_syslog('',0,1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Define sort criteria of request
|
||||
*
|
||||
|
||||
@ -287,33 +287,6 @@ class DoliDBMysql extends DoliDB
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Start transaction
|
||||
*
|
||||
* @return int 1 if transaction successfuly opened or already opened, 0 if error
|
||||
*/
|
||||
function begin()
|
||||
{
|
||||
if (! $this->transaction_opened)
|
||||
{
|
||||
$ret=$this->query("BEGIN");
|
||||
if ($ret)
|
||||
{
|
||||
$this->transaction_opened++;
|
||||
dol_syslog("BEGIN Transaction",LOG_DEBUG);
|
||||
dol_syslog('',0,1);
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->transaction_opened++;
|
||||
dol_syslog('',0,1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate a database transaction
|
||||
*
|
||||
|
||||
@ -291,33 +291,6 @@ class DoliDBMysqli extends DoliDB
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Start transaction
|
||||
*
|
||||
* @return int 1 if transaction successfuly opened or already opened, 0 if error
|
||||
*/
|
||||
function begin()
|
||||
{
|
||||
if (! $this->transaction_opened)
|
||||
{
|
||||
$ret=$this->query("BEGIN");
|
||||
if ($ret)
|
||||
{
|
||||
$this->transaction_opened++;
|
||||
dol_syslog("BEGIN Transaction",LOG_DEBUG);
|
||||
dol_syslog('',0,1);
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->transaction_opened++;
|
||||
dol_syslog('',0,1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate a database transaction
|
||||
*
|
||||
|
||||
@ -415,33 +415,6 @@ class DoliDBSqlite extends DoliDB
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Start transaction
|
||||
*
|
||||
* @return int 1 if transaction successfuly opened or already opened, 0 if error
|
||||
*/
|
||||
function begin()
|
||||
{
|
||||
if (! $this->transaction_opened)
|
||||
{
|
||||
$ret=$this->query("BEGIN");
|
||||
if ($ret)
|
||||
{
|
||||
$this->transaction_opened++;
|
||||
dol_syslog("BEGIN Transaction",LOG_DEBUG);
|
||||
dol_syslog('',0,1);
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->transaction_opened++;
|
||||
dol_syslog('',0,1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate a database transaction
|
||||
*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user