Skip to content
Snippets Groups Projects
Commit 7baa752f authored by Adrien Chabod's avatar Adrien Chabod
Browse files

nouvelles requetes

parent 166f6288
No related branches found
No related tags found
1 merge request!1MAJ BDD + Data commande fonctionnel
......@@ -62,6 +62,23 @@ def mysql_get_cocktail_composition_with_bec(id_cocktail):
connection.close()
return data
def mysql_get_bec_from_ingredient(id_ingredient):
connection = connect_db()
cursor = connection.cursor()
cursor.execute("SELECT id_bec FROM ingredient WHERE id_ingredient = %s", (id_ingredient,))
data = cursor.fetchall()
cursor.close()
connection.close()
return data
def mysql_add_ingredient(id_bec, nom_ingredient):
connection = connect_db()
cursor = connection.cursor()
cursor.execute("INSERT INTO ingredient ""(id_bec, non_ingredient) " "VALUES (%s, %s)", (id_bec, nom_ingredient,))
connection.commit()
cursor.close()
connection.close()
def formalize_data_list(function):
initial_data = function()
new_data = "/".join([",".join([str(k) for k in x]) for x in initial_data])
......
from bibliotheques.sql import *
from ..bibliotheques.sql.sql import *
print(mysql_get_cocktail_list())
print(mysql_get_ingredient_list())
print(mysql_get_quantite_machine())
print(mysql_get_all_cocktail_composition_without_bec())
print(mysql_get_cocktail_composition_without_bec(1))
print(mysql_get_cocktail_composition_with_bec(1))
\ No newline at end of file
print(mysql_get_cocktail_composition_with_bec(1))
mysql_add_ingredient(10, "test")
print(mysql_get_bec_from_ingredient(1))
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment