From: Vincent Le Gallic Date: Sat, 18 Nov 2017 10:31:39 +0000 (+0100) Subject: trouver --all pour chercher aussi dans les alias et anciens pseudos X-Git-Url: http://gitweb.pimeys.fr/?a=commitdiff_plain;h=3e4a8414d0c72fca4581138640771157841d2b78;p=scripts-20-100.git trouver --all pour chercher aussi dans les alias et anciens pseudos --- diff --git a/bde/trouver.sh b/bde/trouver.sh index 29d76b8..8f50312 100755 --- a/bde/trouver.sh +++ b/bde/trouver.sh @@ -6,9 +6,15 @@ for i in $@ 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 @@ -23,5 +29,10 @@ then 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