From e06766c11f294c4c3db3d90e855bc313e6165cee Mon Sep 17 00:00:00 2001 From: Vincent Le Gallic Date: Sun, 9 Nov 2014 20:34:37 +0100 Subject: [PATCH] =?utf8?q?scripts=20bde=20:=20passage=20=C3=A0=20la=20nouv?= =?utf8?q?elle=20base=20de=20donn=C3=A9es=20(seulement=20certains)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- bde/activites.sh | 2 +- bde/transactions.sh | 8 ++++---- bde/trouver.sh | 14 +++++++------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/bde/activites.sh b/bde/activites.sh index 2d3efd0..82ff111 100755 --- a/bde/activites.sh +++ b/bde/activites.sh @@ -16,4 +16,4 @@ then WHERE="WHERE titre ILIKE '%pot%' " fi -psql bde -c "SELECT * FROM activites ${WHERE}ORDER BY debut DESC;" +psql note -c "SELECT * FROM activites ${WHERE}ORDER BY debut DESC;" diff --git a/bde/transactions.sh b/bde/transactions.sh index f7d4b00..f214085 100755 --- a/bde/transactions.sh +++ b/bde/transactions.sh @@ -4,9 +4,9 @@ export LESS='-S' -psql bde -c " - SELECT t.id,t.date,t.quantite,t.montant,t.remarque,t.valide,t.emetteur,t.destinataire, +psql note -c " + SELECT t.id,t.date,t.quantite,t.montant,t.description,t.valide,t.emetteur,t.destinataire, adhe.pseudo AS emetteur, adhd.pseudo AS destinataire - FROM transactions AS t, adherents AS adhe, adherents AS adhd - WHERE $1 in (emetteur, destinataire) AND t.emetteur=adhe.numcbde AND t.destinataire=adhd.numcbde AND valide + FROM transactions AS t, comptes AS adhe, comptes AS adhd + WHERE $1 in (emetteur, destinataire) AND t.emetteur=adhe.idbde AND t.destinataire=adhd.idbde AND valide ORDER BY date DESC;" diff --git a/bde/trouver.sh b/bde/trouver.sh index 47dca06..920219f 100755 --- a/bde/trouver.sh +++ b/bde/trouver.sh @@ -7,21 +7,21 @@ do if [ $i = "--no-mail" ] then nomail=1; fi; - if [ $i = "--numcbde" ] - then searchnumcbde=1; + if [ $i = "--idbde" ] + then searchidcbde=1; fi done # Si on n'a *pas* mis --no-mail (too many negations, I know) if [ -z "${nomail}" ] then - adding=" OR email ILIKE '%$1%'" + adding=" OR mail ILIKE '%$1%'" fi -# Si on a mis --numcbde, il faut matcher numcbde de manière plus lâche -if [ "${searchnumcbde}" = "1" ] +# Si on a mis --idcbde, il faut matcher numcbde de manière plus lâche +if [ "${searchidcbde}" = "1" ] then wild="%" fi -psql bde -c "SELECT * FROM adherents WHERE pseudo ILIKE '%$1%' OR nom ILIKE '%$1%' - OR prenom ILIKE '%$1%'${adding} OR CAST(numcbde 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;" -- 2.39.2