1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
/* selectionner les interventions */
DELIMITER //
Create procedure selectinter(date_actuelle date,utilisateur integer,future boolean,passee boolean,fait boolean,pause boolean,cours boolean,faire boolean,moi boolean)
BEGIN
declare tut text;
if not future then set tut='date_intervention<date_actuelle' ;
end if;
if not passee then
if tut!='' then set tut=concat(tut,' and ');
end if;
set tut=concat(tut,'date_intervention>date_actuelle') ;
end if;
if not fait then
if tut!='' then set tut=concat(tut,' and ');
end if;
set tut=concat(tut,'id_statut!=1') ;
end if;
if not pause then
if tut!='' then set tut=concat(tut,' and ');
end if;
set tut=concat(tut,'id_statut!=2') ;
end if;
if not cours then
if tut!='' then set tut=concat(tut,' and ');
end if;
set tut=concat(tut,'id_statut!=3') ;
end if;
if not faire then
if tut!='' then set tut=concat(tut,' and ');
end if;
set tut=concat(tut,'id_statut!=4') ;
end if;
if moi then
if tut!='' then set tut=concat(tut,' and ');
end if;
set tut=concat(tut,'uti_id_utilisateur=utilisateur') ;
end if;
select * from intervention where select(tut);
end;
//
DELIMITER ; |
Partager