forked from Wavyzz/dolibarr
@@ -125,6 +125,71 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Define limits and offset of request
|
||||
*
|
||||
* @param int $limit Maximum number of lines returned (-1=conf->liste_limit, 0=no limit)
|
||||
* @param int $offset Numero of line from where starting fetch
|
||||
* @return string String with SQL syntax to add a limit and offset
|
||||
*/
|
||||
function plimit($limit=0,$offset=0)
|
||||
{
|
||||
global $conf;
|
||||
if (empty($limit)) return "";
|
||||
if ($limit < 0) $limit=$conf->liste_limit;
|
||||
if ($offset > 0) return " LIMIT $offset,$limit ";
|
||||
else return " LIMIT $limit ";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return version of database server into an array
|
||||
*
|
||||
|
||||
@@ -466,24 +466,6 @@ class DoliDBMssql extends DoliDB
|
||||
if (is_resource($resultset)) mssql_free_result($resultset);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Define limits and offset of request
|
||||
*
|
||||
* @param int $limit Maximum number of lines returned (-1=conf->liste_limit, 0=no limit)
|
||||
* @param int $offset Numero of line from where starting fetch
|
||||
* @return string String with SQL syntax to add a limit and offset
|
||||
*/
|
||||
function plimit($limit=0,$offset=0)
|
||||
{
|
||||
global $conf;
|
||||
if (empty($limit)) return "";
|
||||
if ($limit < 0) $limit=$conf->liste_limit;
|
||||
if ($offset > 0) return " LIMIT $offset,$limit ";
|
||||
else return " LIMIT $limit ";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Escape a string to insert data
|
||||
*
|
||||
|
||||
@@ -239,55 +239,6 @@ class DoliDBMysql extends DoliDB
|
||||
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
|
||||
*
|
||||
@@ -414,24 +365,6 @@ class DoliDBMysql extends DoliDB
|
||||
if (is_resource($resultset)) mysql_free_result($resultset);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Define limits and offset of request
|
||||
*
|
||||
* @param int $limit Maximum number of lines returned (-1=conf->liste_limit, 0=no limit)
|
||||
* @param int $offset Numero of line from where starting fetch
|
||||
* @return string String with SQL syntax to add a limit and offset
|
||||
*/
|
||||
function plimit($limit=0,$offset=0)
|
||||
{
|
||||
global $conf;
|
||||
if (empty($limit)) return "";
|
||||
if ($limit < 0) $limit=$conf->liste_limit;
|
||||
if ($offset > 0) return " LIMIT $offset,$limit ";
|
||||
else return " LIMIT $limit ";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Escape a string to insert data
|
||||
*
|
||||
|
||||
@@ -243,55 +243,6 @@ class DoliDBMysqli extends DoliDB
|
||||
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
|
||||
*
|
||||
@@ -425,24 +376,6 @@ class DoliDBMysqli extends DoliDB
|
||||
if (is_object($resultset)) mysqli_free_result($resultset);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Define limits and offset of request
|
||||
*
|
||||
* @param int $limit Maximum number of lines returned (-1=conf->liste_limit, 0=no limit)
|
||||
* @param int $offset Numero of line from where starting fetch
|
||||
* @return string String with SQL syntax to add a limit and offset
|
||||
*/
|
||||
function plimit($limit=0,$offset=0)
|
||||
{
|
||||
global $conf;
|
||||
if (empty($limit)) return "";
|
||||
if ($limit < 0) $limit=$conf->liste_limit;
|
||||
if ($offset > 0) return " LIMIT $offset,$limit ";
|
||||
else return " LIMIT $limit ";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Escape a string to insert data
|
||||
*
|
||||
|
||||
@@ -448,82 +448,6 @@ class DoliDBPgsql 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
|
||||
*
|
||||
* @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
|
||||
*
|
||||
|
||||
@@ -368,55 +368,6 @@ class DoliDBSqlite extends DoliDB
|
||||
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
|
||||
*
|
||||
@@ -559,24 +510,6 @@ class DoliDBSqlite extends DoliDB
|
||||
if (is_object($resultset)) $resultset->closeCursor();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Define limits and offset of request
|
||||
*
|
||||
* @param int $limit Maximum number of lines returned (-1=conf->liste_limit, 0=no limit)
|
||||
* @param int $offset Numero of line from where starting fetch
|
||||
* @return string String with SQL syntax to add a limit and offset
|
||||
*/
|
||||
function plimit($limit=0,$offset=0)
|
||||
{
|
||||
global $conf;
|
||||
if (empty($limit)) return "";
|
||||
if ($limit < 0) $limit=$conf->liste_limit;
|
||||
if ($offset > 0) return " LIMIT $offset,$limit ";
|
||||
else return " LIMIT $limit ";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Escape a string to insert data
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user