do
if [ $i = "--no-mail" ]
then nomail=1;
+ shift;
fi;
if [ $i = "--idbde" ]
then searchidcbde=1;
+ shift;
+ fi
+ if [ $i = "--all" ] || [ $i = "-a" ]
+ then searchall=1;
+ shift;
fi
done
wild="%"
fi
-psql note -c "SELECT * FROM comptes WHERE pseudo ILIKE '%$1%' OR nom ILIKE '%$1%'
- OR prenom ILIKE '%$1%'${adding} OR CAST(idbde AS varchar) LIKE '${wild}$1${wild}' ORDER BY nom;"
+ psql note -c "SELECT * FROM comptes WHERE pseudo ILIKE '%$1%' OR nom ILIKE '%$1%'
+ OR prenom ILIKE '%$1%'${adding} OR CAST(idbde AS varchar) LIKE '${wild}$1${wild}' ORDER BY nom;"
+if [ -n "${searchall}" ]
+then
+ psql note -c "SELECT a.*, c.* FROM aliases AS a, comptes AS c WHERE a.idbde = c.idbde AND a.alias ILIKE '%$1%' ORDER BY a.alias;"
+ psql note -c "SELECT h.*, c.* FROM historique AS h, comptes AS c WHERE h.idbde = c.idbde AND h.avant ILIKE '%$1%' ORDER BY h.avant;"
+fi