Langages et normes: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Line 235: Line 235:


Il existe une exception.
Il existe une exception.
Les requêtes "UPDATE FROM".
Les requêtes "UPDATE FROM" :
    There is a non solve issue between PgSQL and MySQL, the "update from" request.
Syntax MySQL :
Syntax MySQL :
<source lang="sql">
UPDATE table_taget as target, table_source as source SET fieldtarget=source.fieldsource
UPDATE table_taget as target, table_source as source SET fieldtarget=source.fieldsource
WHERE source.rowid=target.rowid;
WHERE source.rowid=target.rowid;
</source>


Syntax PgSQL:
Syntax PgSQL:
<source lang="sql">
UPDATE table_taget as target SET fieldtarget=source.fieldsource
UPDATE table_taget as target SET fieldtarget=source.fieldsource
FROM table_source as source WHERE source.rowid=target.rowid;
FROM table_source as source WHERE source.rowid=target.rowid;
</source>


Il n'en existe pas dans Dolibarr, mais pour vos modules Vous devriez faire tel que :
Il n'en existe pas dans Dolibarr, mais pour vos modules Vous devriez faire tel que :
 
<source lang="php">
if ($this->db->type=='pgsql') {
if ($this->db->type=='pgsql') {
$sql="UPDATE table_taget as target SET fieldtarget=source.fieldsource
$sql="UPDATE table_taget as target SET fieldtarget=source.fieldsource
Line 254: Line 257:
WHERE source.rowid=target.rowid";
WHERE source.rowid=target.rowid";
}
}
</source>


= Normes HTML =
= Normes HTML =
Bureaucrats, emailconfirmed, Administrators
840

edits

Navigation menu