diff --git a/__pycache__/interface.cpython-38.pyc b/__pycache__/interface.cpython-38.pyc new file mode 100644 index 0000000..f80149f Binary files /dev/null and b/__pycache__/interface.cpython-38.pyc differ diff --git a/__pycache__/personnage.cpython-38.pyc b/__pycache__/personnage.cpython-38.pyc new file mode 100644 index 0000000..91f69c1 Binary files /dev/null and b/__pycache__/personnage.cpython-38.pyc differ diff --git a/base_de_donnee.py b/base_de_donnee.py index 124e490..5749c4f 100644 --- a/base_de_donnee.py +++ b/base_de_donnee.py @@ -1,11 +1,28 @@ import sqlite3 class BaseDeDonnee: - def __init__(self): - self.con = sqlite3.cursor("table_personnages.db") + def __init__(self, nom): + self.nom = nom + + self.con = sqlite3.connect("jdr_base.db") + self.cur = self.con.cursor() + + self.cur.execute("CREATE TABLE IF NOT EXISTS "+self.nom+" (id INT PRIMARY KEY NOT NULL,nom VARCHAR(100),categorie VARCHAR(100),exp INT)") + + self.con.commit() + self.con.close() + + def __str__(self): + self.con = sqlite3.connect("jdr_base.db") self.cur = self.con.cursor() - self.cur.execute("CREATE TABLE persos (nom)") + res = self.cur.execute("SELECT * FROM "+self.nom).fetchall() + self.con.commit() self.con.close() + return str(res) + + def ajouter_personnage(self): + pass + diff --git a/jdr_base.db b/jdr_base.db new file mode 100644 index 0000000..15e0c92 Binary files /dev/null and b/jdr_base.db differ