From 0ef9f584c34cfe727c67c011e989f66ba3dadc26 Mon Sep 17 00:00:00 2001 From: "Committo,Ergo:sum" <esj@rezo.net> Date: Thu, 4 May 2006 20:59:08 +0000 Subject: [PATCH] =?UTF-8?q?Corrige=20(mais=20pourrait=20=C3=AAtre=20am?= =?UTF-8?q?=C3=A9lior=C3=A9)=20#256=20ainsi=20que=20le=20pb=20de=20=20Pif?= =?UTF-8?q?=20http://article.gmane.org/gmane.comp.web.spip.devel/34423?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ecrire/public/criteres.php | 10 +++++++--- ecrire/public/references.php | 9 ++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ecrire/public/criteres.php b/ecrire/public/criteres.php index 642ac47c36..92c1d03b19 100644 --- a/ecrire/public/criteres.php +++ b/ecrire/public/criteres.php @@ -687,11 +687,15 @@ function calculer_chaine_jointures(&$boucle, $depart, $arrivee, $vu=array()) list($anom,$adesc) = $arrivee; $keys = $ddesc['key']; - + if ($v = $adesc['key']['PRIMARY KEY']) { + unset($adesc['key']['PRIMARY KEY']); + $akeys = array_merge(preg_split('/,\s*/', $v), $adesc['key']); + } + else $akeys = $adesc['key']; // priorite a la primaire, qui peut etre multiple - if ($v = (split(', *', $keys['PRIMARY KEY']))) + if ($v = (preg_split('/,\s*/', $keys['PRIMARY KEY']))) $keys = $v; - $v = array_intersect($keys, $adesc['key']); + $v = array_intersect($keys, $akeys); if ($v) return array(array($dnom, $arrivee, array_shift($v))); else { diff --git a/ecrire/public/references.php b/ecrire/public/references.php index 3ca07787cc..e9cf216a15 100644 --- a/ecrire/public/references.php +++ b/ecrire/public/references.php @@ -101,7 +101,7 @@ function description_type_requete($type, $serveur='') { } function index_tables_en_pile($idb, $nom_champ, &$boucles) { - global $exceptions_des_tables, $tables_des_serveurs_sql; + global $exceptions_des_tables; $r = $boucles[$idb]->type_requete; $s = $boucles[$idb]->sql_serveur; @@ -128,8 +128,11 @@ function index_tables_en_pile($idb, $nom_champ, &$boucles) { $t = trouver_champ_exterieur($nom_champ, $boucles[$idb]->jointures, $boucles[$idb]); - if ($t) $t = array_search($t[0], $boucles[$idb]->from); - if ($t) return array($t .'.' . $nom_champ, $nom_champ); + if ($t) + return index_exception($boucles[$idb], + $desc, + $nom_champ, + array($t[0], $nom_champ)); } return array('',''); } -- GitLab