diff --git a/ecrire/public/compiler.php b/ecrire/public/compiler.php index 9a314706d0013bb1bf17d0f36232eecbab515ae6..48293f30fcc8274e743b7836b9c658ab7b762aca 100644 --- a/ecrire/public/compiler.php +++ b/ecrire/public/compiler.php @@ -300,6 +300,8 @@ function calculer_requete_sql(&$boucle) '"), # SELECT ' . calculer_from($boucle) . ', # FROM + ' . calculer_from_type($boucle) . + ', # FROM type jointure ' . calculer_dump_array($boucle->where) . ', # WHERE ' . calculer_dump_join($boucle->join) @@ -351,6 +353,14 @@ function calculer_from(&$boucle) return 'array(' . substr($res,1) . ')'; } +// http://doc.spip.org/@calculer_from_type +function calculer_from_type(&$boucle) +{ + $res = ""; + foreach($boucle->from_type as $k => $v) $res .= ",'$k' => '$v'"; + return 'array(' . substr($res,1) . ')'; +} + // http://doc.spip.org/@calculer_order function calculer_order(&$boucle) { diff --git a/ecrire/public/composer.php b/ecrire/public/composer.php index 505a7ddb209496f6c80eceed33a620d15b7f7e61..6036f6ae1bcf1acf2075f42826071ed5a6c51cc2 100644 --- a/ecrire/public/composer.php +++ b/ecrire/public/composer.php @@ -471,7 +471,8 @@ function lang_parametres_forum($qs, $lang) { // http://doc.spip.org/@calculer_select function calculer_select ($select = array(), $from = array(), - $where = array(), $join=array(), + $from_type = array(), + $where = array(), $join=array(), $groupby = array(), $orderby = array(), $limit = '', $having=array(), $table = '', $id = '', $serveur='') { @@ -509,7 +510,7 @@ function calculer_select ($select = array(), $from = array(), OR calculer_jointnul($cle, $select) OR calculer_jointnul($cle, $join) OR calculer_jointnul($cle, $where)) - $sfrom = "\n\tINNER JOIN " . $from[$cle] . " AS $cle ON $t.$c=$cle.$c" . $sfrom; + $sfrom = "\n\t".(isset($from_type[$cle])?$from_type[$cle]:"INNER")." JOIN " . $from[$cle] . " AS $cle ON $t.$c=$cle.$c" . $sfrom; else { unset($join[$k]);} unset($from[$cle]); } diff --git a/ecrire/public/interfaces.php b/ecrire/public/interfaces.php index 18a7706c376659123af3f1ec520344dbdd11a2a8..fe209f50db9c9ade9c2807f80071ead7b101caae 100644 --- a/ecrire/public/interfaces.php +++ b/ecrire/public/interfaces.php @@ -57,6 +57,7 @@ class Boucle { // champs pour la construction de la requete SQL var $select = array(); var $from = array(); + var $from_type = array(); var $where = array(); var $join = array(); var $having = array();