Skip to content

Instantly share code, notes, and snippets.

ata4

Block or report user

Report or block ata4

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@elyezer
elyezer / ring_buffer.sql
Last active May 6, 2019
How to create a ring buffer table in SQLite
View ring_buffer.sql
-- Example table
CREATE TABLE ring_buffer (id INTEGER PRIMARY KEY AUTOINCREMENT, data TEXT);
-- Number 10 on where statement defines the ring buffer's size
CREATE TRIGGER delete_tail AFTER INSERT ON ring_buffer
BEGIN
DELETE FROM ring_buffer WHERE id%10=NEW.id%10 AND id!=NEW.id;
END;
You can’t perform that action at this time.