Skip to content

Instantly share code, notes, and snippets.

@lwzm
Last active August 29, 2015 14:01
Show Gist options
  • Save lwzm/46555e54d688d42ab3b2 to your computer and use it in GitHub Desktop.
Save lwzm/46555e54d688d42ab3b2 to your computer and use it in GitHub Desktop.
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))
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment