force right type in requete
This commit is contained in:
parent
eb02269bbb
commit
2af04ba300
1 changed files with 3 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
||||||
import sqlite3
|
import sqlite3
|
||||||
|
|
||||||
class Database:
|
class Database:
|
||||||
def __init__(self, urlDatabase):
|
def __init__(self, urlDatabase: str):
|
||||||
self.connexion = self.createConnection(urlDatabase)
|
self.connexion = self.createConnection(urlDatabase)
|
||||||
|
|
||||||
def createConnection(self, path):
|
def createConnection(self, path):
|
||||||
|
@ -29,6 +29,8 @@ class Database:
|
||||||
try:
|
try:
|
||||||
curseur = self.connexion.cursor()
|
curseur = self.connexion.cursor()
|
||||||
if valeurs:
|
if valeurs:
|
||||||
|
if type(valeurs) not in [list, tuple]:
|
||||||
|
valeurs = [valeurs]
|
||||||
curseur.execute(requete, valeurs)
|
curseur.execute(requete, valeurs)
|
||||||
else:
|
else:
|
||||||
curseur.execute(requete)
|
curseur.execute(requete)
|
||||||
|
|
Reference in a new issue