Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
Clinique Veterinaire
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TD_NF17_goupe4
Clinique Veterinaire
Commits
da9f5959
Commit
da9f5959
authored
Jun 17, 2019
by
Lingfeng Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update prog.py
parent
5bdbbce7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
2 deletions
+49
-2
Projet/prog.py
Projet/prog.py
+49
-2
No files found.
Projet/prog.py
View file @
da9f5959
...
...
@@ -280,6 +280,7 @@ CONTROLLER FUCNTIONS SECTION
"""
def
afficherSql
(
conn
,
sql
):
try
:
cur
=
conn
.
cursor
()
cur
.
execute
(
sql
)
except
pg
.
Error
as
e
:
print
(
"Execute: "
,
e
)
...
...
@@ -289,16 +290,18 @@ def afficherSql(conn,sql):
try
:
raw
=
cur
.
fetchone
()
if
raw
:
print
(
'*'
*
30
)
while
raw
:
for
i
in
raw
:
print
(
i
,
end
=
", "
)
print
(
""
)
raw
=
cur
.
fetchone
()
print
(
'*'
*
30
)
else
:
print
(
"Empty table"
)
conn
.
commit
()
except
pg
.
Error
as
e
:
print
(
"Fetch error"
,
e
)
print
(
"Fetch error"
,
e
)
conn
.
rollback
()
def
afficherStatistique
(
conn
):
...
...
@@ -306,12 +309,14 @@ def afficherStatistique(conn):
sql
=
""
while
True
:
choix
=
0
print
(
'*'
*
30
)
print
(
"1.Selection des prescriptions d'un animal (pas demandé mais aide à l'analyse de la statistique"
)
print
(
"2.Statistique medicament pour un animal"
)
print
(
"3.Statistique quantite prescrite pour un medicament particulier"
)
print
(
"4.Poids moyen par espèce "
)
print
(
"5.Taille moyenne par espèce "
)
print
(
"6.Quitter"
)
print
(
'*'
*
30
)
choix
=
int
(
input
())
if
(
choix
==
1
):
id
=
input
(
"Entrez ID d'animal: "
);
...
...
@@ -341,7 +346,49 @@ def afficherTable(conn):
if
table
.
lower
()
in
tables
:
sql
=
"SELECT * FroM "
+
table
afficherSql
(
conn
,
sql
)
def
afficherMenu
(
conn
):
while
True
:
print
(
'*'
*
30
)
print
(
"1.afficher un table"
)
print
(
"2.afficher les statistiques"
)
print
(
"3.return"
)
choix
=
input
(
""
)
if
choix
==
'3'
:
return
elif
choix
==
'2'
:
afficherStatistique
(
conn
)
elif
choix
==
'1'
:
afficherTable
(
conn
)
def
Main
():
HOST
=
"tuxa.sme.utc"
USER
=
"bdd0p071"
PASSWORD
=
"MFyllo2A"
DATABASE
=
"dbbdd0p071"
conn
=
pg
.
connect
(
"host=%s dbname=%s user=%s password=%s"
%
(
HOST
,
DATABASE
,
USER
,
PASSWORD
))
while
True
:
print
(
'*'
*
30
)
print
(
"1.afficher"
)
print
(
"2.insert"
)
print
(
"3,supprimer"
)
print
(
"4.modifier"
)
print
(
'*'
*
30
)
print
(
"Entrez votre choix:"
)
choix
=
input
()
if
(
choix
==
"1"
):
afficherMenu
(
conn
)
else
:
break
"""
elif(choix =='2'):
pass
elif(choix=='3'):
pass
elif(choix=='4'):
pass
else:
return
"""
return
True
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment