Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Code Python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
procom2022-robotise
Code Python
Commits
7308d590
Commit
7308d590
authored
2 years ago
by
Adrien Chabod
Browse files
Options
Downloads
Patches
Plain Diff
ajout type
parent
c0658d63
No related branches found
No related tags found
1 merge request
!1
MAJ BDD + Data commande fonctionnel
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bibliotheques/sql/sql.py
+4
-4
4 additions, 4 deletions
bibliotheques/sql/sql.py
tests/test_sql.py
+2
-2
2 additions, 2 deletions
tests/test_sql.py
with
6 additions
and
6 deletions
bibliotheques/sql/sql.py
+
4
−
4
View file @
7308d590
...
...
@@ -44,7 +44,7 @@ def mysql_get_all_cocktail_composition_without_bec():
connection
.
close
()
return
data
def
mysql_get_cocktail_composition_without_bec
(
id_cocktail
):
def
mysql_get_cocktail_composition_without_bec
(
id_cocktail
:
int
):
connection
=
connect_db
()
cursor
=
connection
.
cursor
()
cursor
.
execute
(
"
SELECT cocktail.id_cocktail, nom_cocktail, nom_ingredient, quantite FROM composition INNER JOIN cocktail ON composition.id_cocktail = cocktail.id_cocktail INNER JOIN ingredient ON composition.id_ingredient = ingredient.id_ingredient WHERE cocktail.id_cocktail = %s
"
,
(
id_cocktail
,))
...
...
@@ -53,7 +53,7 @@ def mysql_get_cocktail_composition_without_bec(id_cocktail):
connection
.
close
()
return
data
def
mysql_get_cocktail_composition_with_bec
(
id_cocktail
):
def
mysql_get_cocktail_composition_with_bec
(
id_cocktail
:
int
):
connection
=
connect_db
()
cursor
=
connection
.
cursor
()
cursor
.
execute
(
"
SELECT cocktail.id_cocktail, nom_cocktail, nom_ingredient, quantite, id_bec FROM composition INNER JOIN cocktail ON composition.id_cocktail = cocktail.id_cocktail INNER JOIN ingredient ON composition.id_ingredient = ingredient.id_ingredient WHERE cocktail.id_cocktail = %s
"
,
(
id_cocktail
,))
...
...
@@ -62,7 +62,7 @@ def mysql_get_cocktail_composition_with_bec(id_cocktail):
connection
.
close
()
return
data
def
mysql_get_bec_from_ingredient
(
id_ingredient
):
def
mysql_get_bec_from_ingredient
(
id_ingredient
:
int
):
connection
=
connect_db
()
cursor
=
connection
.
cursor
()
cursor
.
execute
(
"
SELECT id_bec FROM ingredient WHERE id_ingredient = %s
"
,
(
id_ingredient
,))
...
...
@@ -71,7 +71,7 @@ def mysql_get_bec_from_ingredient(id_ingredient):
connection
.
close
()
return
data
def
mysql_add_ingredient
(
id_bec
,
nom_ingredient
):
def
mysql_add_ingredient
(
nom_ingredient
:
str
):
connection
=
connect_db
()
cursor
=
connection
.
cursor
()
cursor
.
execute
(
"
INSERT INTO ingredient
""
(nom_ingredient)
"
"
VALUES (%s)
"
,
(
nom_ingredient
,))
...
...
This diff is collapsed.
Click to expand it.
tests/test_sql.py
+
2
−
2
View file @
7308d590
from
..
bibliotheques.sql.sql
import
*
from
bibliotheques.sql.sql
import
*
print
(
mysql_get_cocktail_list
())
print
(
mysql_get_ingredient_list
())
...
...
@@ -7,4 +7,4 @@ print(mysql_get_all_cocktail_composition_without_bec())
print
(
mysql_get_cocktail_composition_without_bec
(
1
))
print
(
mysql_get_cocktail_composition_with_bec
(
1
))
print
(
mysql_get_bec_from_ingredient
(
1
))
mysql_add_ingredient
(
1
,
"
test
"
)
\ No newline at end of file
mysql_add_ingredient
(
"
test
"
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment