Fix codice a barre + fix fornitore + fix codice alternativo

This commit is contained in:
2024-12-20 15:50:20 +01:00
parent 9484d1e12b
commit 9ea9650b12
11 changed files with 27 additions and 44 deletions

View File

@ -1,23 +0,0 @@
import mysql.connector
from mysql.connector import Error
def create_connection(host_name, user_name, user_password, db_name,port):
connection = None
try:
connection = mysql.connector.connect(
host=host_name,
user=user_name,
password=user_password,
database=db_name,
port=port,
ssl_disabled=True
)
print("Connessione al database riuscita!")
except Error as e:
print(f"Errore: {e}")
return connection
def close_connection(connection):
if connection is not None and connection.is_connected():
connection.close()
print("Connessione al database chiusa.")