Removed SQL string from call debug log

This commit is contained in:
Marcos García de La Fuente
2014-06-13 01:34:39 +02:00
parent 7e7958cf73
commit ca0a6cb307
45 changed files with 90 additions and 101 deletions

View File

@@ -79,7 +79,7 @@ class box_ficheinter extends ModeleBoxes
$sql.= " ORDER BY f.tms DESC";
$sql.= $db->plimit($max, 0);
dol_syslog(get_class($this).'::loadBox sql='.$sql,LOG_DEBUG);
dol_syslog(get_class($this).'::loadBox', LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
{

View File

@@ -653,7 +653,7 @@ abstract class CommonObject
$sql = "SELECT rowid, code, libelle as label, coder";
$sql.= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
$sql.= " WHERE rowid = ".$idtype;
dol_syslog(get_class($this).'::fetch_barcode sql='.$sql);
dol_syslog(get_class($this).'::fetch_barcode', LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
@@ -739,7 +739,7 @@ abstract class CommonObject
$sql.= " WHERE ".$field." = '".$key."'";
$sql.= " AND entity = ".$conf->entity;
dol_syslog(get_class($this).'::fetchObjectFrom sql='.$sql);
dol_syslog(get_class($this).'::fetchObjectFrom', LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
@@ -765,7 +765,7 @@ abstract class CommonObject
$sql = "SELECT ".$field." FROM ".MAIN_DB_PREFIX.$table;
$sql.= " WHERE rowid = ".$id;
dol_syslog(get_class($this).'::getValueFrom sql='.$sql);
dol_syslog(get_class($this).'::getValueFrom', LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
@@ -2484,7 +2484,7 @@ abstract class CommonObject
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element."det";
$sql.= " WHERE ".$this->fk_element." = ".$this->id;
dol_syslog(get_class($this).'::getTotalDiscount sql='.$sql);
dol_syslog(get_class($this).'::getTotalDiscount', LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{

View File

@@ -399,7 +399,7 @@ class ExtraFields
{
$sql="ALTER TABLE ".MAIN_DB_PREFIX.$table." DROP INDEX uk_".$table."_".$attrname;
}
dol_syslog(get_class($this).'::update sql='.$sql);
dol_syslog(get_class($this).'::update', LOG_DEBUG);
$resql=$this->db->query($sql,1,'dml');
return 1;
}
@@ -754,7 +754,7 @@ class ExtraFields
$sql.=preg_replace('/^ AND /','',$sqlwhere);
//print $sql;
dol_syslog(get_class($this).'::showInputField type=sellist sql='.$sql);
dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
@@ -964,7 +964,7 @@ class ExtraFields
$sql.= " WHERE ".$selectkey."='".$this->db->escape($value)."'";
//$sql.= ' AND entity = '.$conf->entity;
dol_syslog(get_class($this).':showOutputField:$type=sellist sql='.$sql);
dol_syslog(get_class($this).':showOutputField:$type=sellist', LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{

View File

@@ -604,7 +604,7 @@ class Form
$sql.= " FROM ".MAIN_DB_PREFIX."c_type_fees as c";
$sql.= " ORDER BY lower(c.libelle) ASC";
dol_syslog(get_class($this).'::load_cache_types_fees sql='.$sql, LOG_DEBUG);
dol_syslog(get_class($this).'::load_cache_types_fees', LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
@@ -1554,7 +1554,7 @@ class Form
$sql.= " ORDER BY date_price";
$sql.= " DESC LIMIT 1";
dol_syslog(get_class($this).'::constructProductListOption search price for level '.$price_level.' sql='.$sql);
dol_syslog(get_class($this).'::constructProductListOption search price for level '.$price_level.'', LOG_DEBUG);
$result2 = $this->db->query($sql);
if ($result2)
{
@@ -2055,7 +2055,7 @@ class Form
$sql.= " FROM ".MAIN_DB_PREFIX.'c_payment_term';
$sql.= " WHERE active=1";
$sql.= " ORDER BY sortorder";
dol_syslog(get_class($this).'::load_cache_conditions_paiements sql='.$sql,LOG_DEBUG);
dol_syslog(get_class($this).'::load_cache_conditions_paiements', LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
@@ -2094,7 +2094,7 @@ class Form
$sql.= " FROM ".MAIN_DB_PREFIX.'c_availability';
$sql.= " WHERE active=1";
$sql.= " ORDER BY rowid";
dol_syslog(get_class($this).'::load_cache_availability sql='.$sql,LOG_DEBUG);
dol_syslog(get_class($this).'::load_cache_availability', LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{

View File

@@ -65,7 +65,7 @@ class FormCompany
$sql.= " WHERE active = 1";
if ($filter) $sql.=" ".$filter;
$sql.= " ORDER by id";
dol_syslog(get_class($this).'::typent_array sql='.$sql,LOG_DEBUG);
dol_syslog(get_class($this).'::typent_array', LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
@@ -104,7 +104,7 @@ class FormCompany
$sql.= " WHERE active = 1";
if ($filter) $sql.=" ".$filter;
$sql .= " ORDER BY id ASC";
dol_syslog(get_class($this).'::effectif_array sql='.$sql,LOG_DEBUG);
dol_syslog(get_class($this).'::effectif_array', LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{

View File

@@ -169,7 +169,7 @@ class FormOther
$sql.= " WHERE e.active = 1 AND e.fk_pays = p.rowid";
$sql.= " ORDER BY pays, e.organization ASC, e.code ASC";
dol_syslog(get_class($this).'::select_ecotaxes sql='.$sql);
dol_syslog(get_class($this).'::select_ecotaxes', LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
@@ -227,7 +227,7 @@ class FormOther
$sql.= " WHERE r.active = 1 AND r.fk_pays = p.rowid";
$sql.= " AND p.code = '".$country_code."'";
dol_syslog(get_class($this).'::select_revenue_stamp sql='.$sql);
dol_syslog(get_class($this).'::select_revenue_stamp', LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{

View File

@@ -197,7 +197,7 @@ class FormProjets
$sql.= ' AND entity='.$conf->entity;
$sql.= " ORDER BY ref DESC";
dol_syslog(get_class($this).'::select_element sql='.$sql,LOG_DEBUG);
dol_syslog(get_class($this).'::select_element', LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)

View File

@@ -674,7 +674,7 @@ class Translate
$sql = "SELECT ".$fieldlabel." as label";
$sql.= " FROM ".MAIN_DB_PREFIX.$tablename;
$sql.= " WHERE ".$fieldkey." = '".($keyforselect?$keyforselect:$key)."'";
dol_syslog(get_class($this).'::getLabelFromKey sql='.$sql,LOG_DEBUG);
dol_syslog(get_class($this).'::getLabelFromKey', LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
{
@@ -754,7 +754,7 @@ class Translate
if (! empty($currency_code)) $sql.=" AND code_iso = '".$currency_code."'";
//$sql.= " ORDER BY code_iso ASC"; // Not required, a sort is done later
dol_syslog(get_class($this).'::loadCacheCurrencies sql='.$sql, LOG_DEBUG);
dol_syslog(get_class($this).'::loadCacheCurrencies', LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
{

View File

@@ -372,7 +372,8 @@ class DoliDBMssql extends DoliDB
$this->lastqueryerror = $query;
$this->lasterror = $this->error();
$this->lasterrno = $row["code"];
dol_syslog(get_class($this)."::query SQL error: ".$query, LOG_ERROR);
dol_syslog(get_class($this)."::query SQL error: ".$this->lasterror." (".$this->lasterrno.")", LOG_ERROR);
}
$this->lastquery=$query;
$this->_results = $ret;

View File

@@ -273,7 +273,9 @@ class DoliDBMysql extends DoliDB
$this->lastqueryerror = $query;
$this->lasterror = $this->error();
$this->lasterrno = $this->errno();
dol_syslog(get_class($this)."::query SQL error: ".$query." ".$this->lasterrno, LOG_ERROR);
dol_syslog(get_class($this)."::query SQL Error query: ".$query, LOG_ERROR);
dol_syslog(get_class($this)."::query SQL Error message: ".$this->lasterror." (".$this->lasterrno.")", LOG_ERROR);
}
$this->lastquery=$query;
$this->_results = $ret;
@@ -829,21 +831,14 @@ class DoliDBMysql extends DoliDB
{
if ($this->lasterrno != 'DB_ERROR_USER_ALREADY_EXISTS')
{
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
return -1;
}
else
{
// If user already exists, we continue to set permissions
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING);
}
}
$sql = "GRANT ALL PRIVILEGES ON ".$this->escape($dolibarr_main_db_name).".* TO '".$this->escape($dolibarr_main_db_user)."'@'".$this->escape($dolibarr_main_db_host)."' IDENTIFIED BY '".$this->escape($dolibarr_main_db_pass)."'";
dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log
$resql=$this->query($sql);
if (! $resql)
{
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
return -1;
}
@@ -853,7 +848,6 @@ class DoliDBMysql extends DoliDB
$resql=$this->query($sql);
if (! $resql)
{
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
return -1;
}

View File

@@ -275,7 +275,8 @@ class DoliDBMysqli extends DoliDB
$this->lastqueryerror = $query;
$this->lasterror = $this->error();
$this->lasterrno = $this->errno();
dol_syslog(get_class($this)."::query SQL error: ".$query." ".$this->lasterrno, LOG_ERROR);
dol_syslog(get_class($this)."::query SQL error: ".$this->lasterror." (".$this->lasterrno.")", LOG_ERROR);
}
$this->lastquery=$query;
$this->_results = $ret;
@@ -833,21 +834,14 @@ class DoliDBMysqli extends DoliDB
{
if ($this->lasterrno != 'DB_ERROR_USER_ALREADY_EXISTS')
{
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
return -1;
}
else
{
// If user already exists, we continue to set permissions
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING);
}
}
$sql = "GRANT ALL PRIVILEGES ON ".$this->escape($dolibarr_main_db_name).".* TO '".$this->escape($dolibarr_main_db_user)."'@'".$this->escape($dolibarr_main_db_host)."' IDENTIFIED BY '".$this->escape($dolibarr_main_db_pass)."'";
dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log
$resql=$this->query($sql);
if (! $resql)
{
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
return -1;
}
@@ -857,7 +851,6 @@ class DoliDBMysqli extends DoliDB
$resql=$this->query($sql);
if (! $resql)
{
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
return -1;
}

View File

@@ -506,9 +506,7 @@ class DoliDBPgsql extends DoliDB
$this->lasterror = $this->error();
$this->lasterrno = $this->errno();
}
dol_syslog(get_class($this)."::query SQL error usesavepoint = ".$usesavepoint." - ".$query." - ".pg_last_error($this->db)." => ".$this->errno(), LOG_ERROR);
//print "\n>> ".$query."<br>\n";
//print '>> '.$this->lasterrno.' - '.$this->lasterror.' - '.$this->lastqueryerror."<br>\n";
dol_syslog(get_class($this)."::query SQL error usesavepoint = ".$usesavepoint." - ".$this->lasterror." (".$this->lasterrno.")", LOG_ERROR);
if ($usesavepoint && $this->transaction_opened) // Warning, after that errno will be erased
{

View File

@@ -409,8 +409,14 @@ class DoliDBSqlite extends DoliDB
$this->lastqueryerror = $query;
$this->lasterror = $this->error();
$this->lasterrno = $this->errno();
if (preg_match('/[0-9]/',$this->lasterrno)) dol_syslog(get_class($this)."::query SQL error: ".$query." ".$this->lasterrno." ".$this->lasterror, LOG_ERROR);
else dol_syslog(get_class($this)."::query SQL error: ".$query." ".$this->lasterrno, LOG_ERROR);
$errormsg = get_class($this)."::query SQL error: ".$this->lasterror;
if (preg_match('/[0-9]/',$this->lasterrno)) {
$errormsg .= ' ('.$this->lasterrno.')';
}
dol_syslog($errormsg, LOG_ERROR);
}
$this->lastquery=$query;
$this->_results = $ret;
@@ -972,7 +978,6 @@ class DoliDBSqlite extends DoliDB
$resql=$this->query($sql);
if (! $resql)
{
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
return -1;
}
@@ -985,7 +990,6 @@ class DoliDBSqlite extends DoliDB
$resql=$this->query($sql);
if (! $resql)
{
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
return -1;
}
@@ -995,7 +999,6 @@ class DoliDBSqlite extends DoliDB
$resql=$this->query($sql);
if (! $resql)
{
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
return -1;
}

View File

@@ -655,7 +655,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
if ($search_name) $sql .= " AND (p.lastname LIKE '%".$db->escape($search_name)."%' OR p.firstname LIKE '%".$db->escape($search_name)."%')";
$sql.= " ORDER BY $sortfield $sortorder";
dol_syslog('core/lib/company.lib.php :: show_contacts sql='.$sql,LOG_DEBUG);
dol_syslog('core/lib/company.lib.php :: show_contacts', LOG_DEBUG);
$result = $db->query($sql);
$num = $db->num_rows($result);

View File

@@ -4197,7 +4197,7 @@ function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id')
$sql = "SELECT ".$fieldid." as id";
$sql.= " FROM ".MAIN_DB_PREFIX.$tablename;
$sql.= " WHERE ".$fieldkey." = '".$key."'";
dol_syslog('dol_getIdFromCode sql='.$sql, LOG_DEBUG);
dol_syslog('dol_getIdFromCode', LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
{

View File

@@ -1293,7 +1293,7 @@ function getListOfModels($db,$type,$maxfilenamelength=0)
$sql.= " WHERE type = '".$type."'";
$sql.= " AND entity IN (0,".(! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)?"1,":"").$conf->entity.")";
dol_syslog('/core/lib/function2.lib.php::getListOfModels sql='.$sql, LOG_DEBUG);
dol_syslog('/core/lib/function2.lib.php::getListOfModels', LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
{

View File

@@ -302,7 +302,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
$sql .= " WHERE p.fk_soc = ".$object->id;
dol_syslog('doc_generic_odt :: sql='.$sql,LOG_DEBUG);
dol_syslog('doc_generic_odt ::', LOG_DEBUG);
$result = $this->db->query($sql);
$num = $this->db->num_rows($result);