Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Francois Mares
NF18 - Projet SCF - Groupe 5
Commits
186174d1
Commit
186174d1
authored
May 20, 2021
by
Francois Mares
Browse files
Upload New File
parent
9aec3881
Changes
1
Hide whitespace changes
Inline
Side-by-side
Python/Admin.py
0 → 100644
View file @
186174d1
import
psycopg2
from
SQL
import
SQL
class
Admin
(
SQL
):
def
__init__
(
self
,
HOST
=
None
,
DATABASE
=
None
,
PASSWORD
=
None
,
USER
=
None
):
super
().
__init__
(
HOST
,
DATABASE
,
PASSWORD
,
USER
)
# PROTECTED
def
_creation_bdd
(
self
):
try
:
connexion
=
self
.
_connexion
()
cur
=
connexion
.
cursor
()
cur
.
execute
(
open
(
"../SQL/TABLE.sql"
,
"r"
).
read
())
connexion
.
commit
()
return
except
psycopg2
.
Error
as
e
:
print
(
"Message système :"
,
e
)
def
_insertions_bdd
(
self
):
try
:
connexion
=
self
.
_connexion
()
cur
=
connexion
.
cursor
()
cur
.
execute
(
open
(
"../SQL/DATA.sql"
,
"r"
).
read
())
connexion
.
commit
()
return
except
psycopg2
.
Error
as
e
:
print
(
"Message système :"
,
e
)
def
_suppression_bdd
(
self
):
try
:
connexion
=
self
.
_connexion
()
cur
=
connexion
.
cursor
()
cur
.
execute
(
open
(
"../SQL/DELETE.sql"
,
"r"
).
read
())
connexion
.
commit
()
return
except
psycopg2
.
Error
as
e
:
print
(
"Message système :"
,
e
)
Write
Preview
Supports
Markdown
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