Import de bdd plus mieux.

This commit is contained in:
klafyvel 2018-01-20 02:03:25 +01:00 committed by root
parent f44f70f40a
commit bea633782b

View file

@ -16,13 +16,13 @@ def process():
cur.execute('''drop table if exists players''') cur.execute('''drop table if exists players''')
cur.execute('''drop table if exists machines''') cur.execute('''drop table if exists machines''')
print("create tables") print("create tables")
cur.execute('''create table players (id int,firstname text,name text, ban_end float)''') cur.execute('''create table players (id integer primary key auto_increment,firstname text not null,name text not null, ban_end double not null)''')
cur.execute('''create table machines (id int,player_id int,ip text)''') cur.execute('''create table machines (id int primary key auto_increment,player_id int not null,ip text not null)''')
print("select players") print("select players")
cur.execute("""select id from players""") cur.execute("""select id from players""")
players = cur.fetchall() players = cur.fetchall()
players = [player[0] for player in players] players = [player[0] for player in players]
print("select machines") print("select machines")
cur.execute("""select ip from machines""") cur.execute("""select ip from machines""")
machines = cur.fetchall() machines = cur.fetchall()