Skip to content
Extraits de code Groupes Projets
Valider f9cf7d6f rédigé par marcimat's avatar marcimat
Parcourir les fichiers

Remplacer la fonction calculer_where par calculer_mysql_where

parent 3d6c000c
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -158,9 +158,9 @@ function spip_mysql_select($select, $from, $where='', ...@@ -158,9 +158,9 @@ function spip_mysql_select($select, $from, $where='',
$query = 'SELECT ' . $query = 'SELECT ' .
(!is_array($select) ? $select : join(", ", $select)) . (!is_array($select) ? $select : join(", ", $select)) .
(!$from ? '' :"\nFROM $from") (!$from ? '' :"\nFROM $from")
. (!$where ? '' : ("\nWHERE " . (!is_array($where) ? $where : (join("\n\tAND ", array_map('calculer_where', $where)))))) . (!$where ? '' : ("\nWHERE " . (!is_array($where) ? $where : (join("\n\tAND ", array_map('calculer_mysql_where', $where))))))
. (!$groupby ? '' : ("\nGROUP BY " . (is_array($groupby) ? join(',',$groupby) : $groupby))) . (!$groupby ? '' : ("\nGROUP BY " . (is_array($groupby) ? join(',',$groupby) : $groupby)))
. (!$having ? '' : "\nHAVING " . (!is_array($having) ? $having : (join("\n\tAND ", array_map('calculer_where', $having))))) . (!$having ? '' : "\nHAVING " . (!is_array($having) ? $having : (join("\n\tAND ", array_map('calculer_mysql_where', $having)))))
. ($orderby ? ("\nORDER BY " . spip_mysql_order($orderby)) :'') . ($orderby ? ("\nORDER BY " . spip_mysql_order($orderby)) :'')
. ($limit ? "\nLIMIT $limit" : ''); . ($limit ? "\nLIMIT $limit" : '');
...@@ -192,8 +192,8 @@ function spip_mysql_order($orderby) ...@@ -192,8 +192,8 @@ function spip_mysql_order($orderby)
} }
// http://doc.spip.org/@calculer_where // http://doc.spip.org/@calculer_mysql_where
function calculer_where($v) function calculer_mysql_where($v)
{ {
if (!is_array($v)) if (!is_array($v))
return $v ; return $v ;
...@@ -202,11 +202,11 @@ function calculer_where($v) ...@@ -202,11 +202,11 @@ function calculer_where($v)
if (!($n=count($v))) if (!($n=count($v)))
return $op; return $op;
else { else {
$arg = calculer_where(array_shift($v)); $arg = calculer_mysql_where(array_shift($v));
if ($n==1) { if ($n==1) {
return "$op($arg)"; return "$op($arg)";
} else { } else {
$arg2 = calculer_where(array_shift($v)); $arg2 = calculer_mysql_where(array_shift($v));
if ($n==2) { if ($n==2) {
return "($arg $op $arg2)"; return "($arg $op $arg2)";
} else return "($arg $op ($arg2) : $v[0])"; } else return "($arg $op ($arg2) : $v[0])";
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter