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
12edbdeb
Commit
12edbdeb
authored
Jun 17, 2019
by
Lingfeng Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update prog.py
parent
f698fb1d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
3 deletions
+24
-3
Projet/prog.py
Projet/prog.py
+24
-3
No files found.
Projet/prog.py
View file @
12edbdeb
...
...
@@ -2,14 +2,14 @@
# http://initd.org/psycopg/docs/usage.html
import
psycopg2
import
psycopg2
as
pg
HOST
=
"tuxa.sme.utc"
USER
=
"bdd0p071"
PASSWORD
=
"MFyllo2A"
DATABASE
=
"dbbdd0p071"
# Open connection
conn
=
p
sycopg2
.
connect
(
"host=%s dbname=%s user=%s password=%s"
%
(
HOST
,
DATABASE
,
USER
,
PASSWORD
))
conn
=
p
g
.
connect
(
"host=%s dbname=%s user=%s password=%s"
%
(
HOST
,
DATABASE
,
USER
,
PASSWORD
))
# Open a cursor to send SQL commands
cur
=
conn
.
cursor
()
# Execute a SQL SELECT command
...
...
@@ -92,6 +92,27 @@ CONTROLLER FUCNTIONS SECTION
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
"""
def
afficherStatistiques
()
def
afficherTable
(
conn
,
table
):
sql
=
"SELECT * FROM "
+
table
try
:
cur
.
execute
(
sql
)
except
psycopg2
.
UndefinedTable
:
print
(
"Table doesn't exist"
)
conn
.
rollback
()
except
psycopg2
.
InFailedSqlTransaction
:
print
(
"Transaction Error"
)
conn
.
rollback
()
# Fetch data line by line
raw
=
cur
.
fetchone
()
if
raw
:
while
raw
:
print
(
raw
[
0
])
print
(
raw
[
1
])
raw
=
cur
.
fetchone
()
else
:
print
(
"Empty table"
)
conn
.
commit
()
def
modifierTables
(
table
)
def
afficherTables
(
table
)
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