5 SPOOL=${SPOOL:-/var/lib/admin/notes}
7 SQL="sqlite3 -bail $DB"
12 create table sequence ( sequence text not null primary key, val integer not null default 0);
18 $SQL "insert into sequence (sequence) values ('$2')"
22 $SQL "delete from sequence where sequence = '$2'"
26 val=$($SQL "select val from sequence where sequence = '$2'")
31 $SQL 'select * from sequence'
35 $SQL "begin;update sequence set val = $3 where sequence = '$seq'; commit;"
45 num=$(sqlite3 $DB "begin; update sequence set val = val + 1 where sequence = '$seq'; commit;select val from sequence where sequence = '$seq';")