postgresql7.1
update users
set second_to_last_visit = last_visit,
last_visit = now(),
n_sessions = n_sessions + 1
where user_id = :user_id
select test_sql('select 1 where 1=[DoubleApos $value]')
select test_sql('select 1 where 1=[DoubleApos "'$value'"]')
insert into secret_tokens(token_id, token, token_timestamp)
values(sec_security_token_id_seq.nextval, :random_token, now())
select token_id, token
from secret_tokens,
(select trunc(random()*(select count(*)-15 from secret_tokens))::integer as first) r
where token_id >= r.first and r.first+15 > token_id;