Browse Source

Import de bdd plus mieux.

master
klafyvel 8 years ago
committed by root
parent
commit
bea633782b
  1. 6
      import_bdd.py

6
import_bdd.py

@ -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()

Loading…
Cancel
Save