lwzm
5/21/2014 - 8:44 AM

login.sql

create table users(
    id integer primary key,
    zone integer not null,
    user text not null,
    name text not null,
    password text default '',
    born real default 0.0,
    ban real default 0.0,
    login real default 0.0,
    logout real default 0.0,
    unique(user, zone),
    unique(name, zone),
    check(length(name) <= 7)
);

/*
insert into t values(null, 1, 'A1', '*', 'n1', 0,0,0);
insert into t values(null, 1, 'A2', '*', 'n1', 0,0,0);  -- fail
insert into t values(null, 1, 'A2', '*', 'n2', 0,0,0);
insert into t values(null, 2, 'A1', '*', 'n1', 0,0,0);
insert into t values(null, 2, 'A1', '*', 'n11', 0,0,0);  -- fail
*/

/*
fmt_u = "U{}".format
fmt_n = "N{}".format
for i in range(10000):
    for z in range(100):
        c.execute(cmd, (None, z, fmt_u(i), "********", fmt_n(i), 0,0,0))
*/