Better perf for phpunit on very large databases

This commit is contained in:
Laurent Destailleur 2020-08-19 01:43:48 +02:00
parent 53522fb8dd
commit 7217dc3114
10 changed files with 18 additions and 1 deletions

View File

@ -3342,6 +3342,8 @@ class Propal extends CommonObject
$sql = "SELECT rowid"; $sql = "SELECT rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."product"; $sql .= " FROM ".MAIN_DB_PREFIX."product";
$sql .= " WHERE entity IN (".getEntity('product').")"; $sql .= " WHERE entity IN (".getEntity('product').")";
$sql .= $this->db->plimit(100);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {

View File

@ -3720,6 +3720,8 @@ class Commande extends CommonOrder
$sql = "SELECT rowid"; $sql = "SELECT rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."product"; $sql .= " FROM ".MAIN_DB_PREFIX."product";
$sql .= " WHERE entity IN (".getEntity('product').")"; $sql .= " WHERE entity IN (".getEntity('product').")";
$sql .= $this->db->plimit(100);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {

View File

@ -1555,6 +1555,8 @@ class FactureRec extends CommonInvoice
$sql = "SELECT rowid"; $sql = "SELECT rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."product"; $sql .= " FROM ".MAIN_DB_PREFIX."product";
$sql .= " WHERE entity IN (".getEntity('product').")"; $sql .= " WHERE entity IN (".getEntity('product').")";
$sql .= $this->db->plimit(100);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {

View File

@ -4090,6 +4090,8 @@ class Facture extends CommonInvoice
$sql = "SELECT rowid"; $sql = "SELECT rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."product"; $sql .= " FROM ".MAIN_DB_PREFIX."product";
$sql .= " WHERE entity IN (".getEntity('product').")"; $sql .= " WHERE entity IN (".getEntity('product').")";
$sql .= $this->db->plimit(100);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {

View File

@ -2310,6 +2310,8 @@ class Contrat extends CommonObject
$sql .= " FROM ".MAIN_DB_PREFIX."product"; $sql .= " FROM ".MAIN_DB_PREFIX."product";
$sql .= " WHERE entity IN (".getEntity('product').")"; $sql .= " WHERE entity IN (".getEntity('product').")";
$sql .= " AND tosell = 1"; $sql .= " AND tosell = 1";
$sql .= $this->db->plimit(100);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {

View File

@ -5142,7 +5142,7 @@ abstract class CommonObject
} }
} }
$sql .= " FROM ".MAIN_DB_PREFIX.$table_element."_extrafields"; $sql .= " FROM ".MAIN_DB_PREFIX.$table_element."_extrafields";
$sql .= " WHERE fk_object = ".$rowid; $sql .= " WHERE fk_object = ".((int) $rowid);
//dol_syslog(get_class($this)."::fetch_optionals get extrafields data for ".$this->table_element, LOG_DEBUG); // Too verbose //dol_syslog(get_class($this)."::fetch_optionals get extrafields data for ".$this->table_element, LOG_DEBUG); // Too verbose
$resql = $this->db->query($sql); $resql = $this->db->query($sql);

View File

@ -2425,6 +2425,7 @@ class FactureFournisseur extends CommonInvoice
$sql = "SELECT rowid"; $sql = "SELECT rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."product"; $sql .= " FROM ".MAIN_DB_PREFIX."product";
$sql .= " WHERE entity IN (".getEntity('product').")"; $sql .= " WHERE entity IN (".getEntity('product').")";
$sql .= $this->db->plimit(100);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)

View File

@ -881,6 +881,8 @@ class Livraison extends CommonObject
$sql .= " FROM ".MAIN_DB_PREFIX."product"; $sql .= " FROM ".MAIN_DB_PREFIX."product";
$sql .= " WHERE entity IN (".getEntity('product').")"; $sql .= " WHERE entity IN (".getEntity('product').")";
$sql .= " AND tosell = 1"; $sql .= " AND tosell = 1";
$sql .= $this->db->plimit(100);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {

View File

@ -1158,6 +1158,8 @@ class Reception extends CommonObject
$sql = "SELECT rowid"; $sql = "SELECT rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."product"; $sql .= " FROM ".MAIN_DB_PREFIX."product";
$sql .= " WHERE entity IN (".getEntity('product').")"; $sql .= " WHERE entity IN (".getEntity('product').")";
$sql .= $this->db->plimit(100);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {

View File

@ -2285,6 +2285,8 @@ class SupplierProposal extends CommonObject
$sql = "SELECT rowid"; $sql = "SELECT rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."product"; $sql .= " FROM ".MAIN_DB_PREFIX."product";
$sql .= " WHERE entity IN (".getEntity('product').")"; $sql .= " WHERE entity IN (".getEntity('product').")";
$sql .= $this->db->plimit(100);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {