File:  [ELWIX - Embedded LightWeight unIX -] / mqtt / etc / mqtt_acc.sql
Revision 1.1.2.3: download - view: text, annotated - select for diffs - revision graph
Mon Nov 28 15:22:25 2011 UTC (12 years, 11 months ago) by misho
Branches: mqtt1_0
add if not exists

PRAGMA foreign_keys=ON;
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS Users (
uid integer primary key AUTOINCREMENT,
Username varchar(64) not null,
Password varchar(64) not null,
Access integer not null,
Stamp timestamp);
CREATE UNIQUE INDEX IF NOT EXISTS User on Users (UserName);
CREATE TRIGGER IF NOT EXISTS Users_update_t AFTER UPDATE ON Users
BEGIN
	UPDATE Users SET Stamp = strftime("%s", "now") WHERE Username = old.Username;
END;
CREATE TRIGGER IF NOT EXISTS Users_insert_t AFTER INSERT ON Users
BEGIN
	UPDATE Users SET Stamp = strftime("%s", "now") WHERE Username = new.Username;
END;
COMMIT;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>