force right type in requete

This commit is contained in:
Mylloon 2021-06-08 11:18:09 +02:00
parent eb02269bbb
commit 2af04ba300

View file

@ -1,7 +1,7 @@
import sqlite3
class Database:
def __init__(self, urlDatabase):
def __init__(self, urlDatabase: str):
self.connexion = self.createConnection(urlDatabase)
def createConnection(self, path):
@ -29,6 +29,8 @@ class Database:
try:
curseur = self.connexion.cursor()
if valeurs:
if type(valeurs) not in [list, tuple]:
valeurs = [valeurs]
curseur.execute(requete, valeurs)
else:
curseur.execute(requete)