What Is Going On Jun 24, 2019 What exactly is going on in this life we live in? I do not know. I haven’t the faintest idea of anything that happens. I simply know I am living here and is that enough? Is that enough to make things work? Is it enough to enable life to be something better than it is? I do not know. I simply don’t have any idea of what is going on. I don’t understand or realize any of it. I wish I did. Yet here we are waiting for something better to come around. Something much much better to have an understanding of. Is that not the end goal of life? To better understand each other and ourselves as much as possible?
Here's some code I'm working on for a sqlite3 database to store backup file content. Might add a BLOB type later for storing binary data. Not sure yet.
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE files (id INTEGER PRIMARY KEY,
name TEXT,
content TEXT,
created_ts TEXT,
modified_ts TEXT);
CREATE TABLE files_log(id INTEGER PRIMARY KEY,
fileid TEXT,
name TEXT,
content TEXT,
created_ts TEXT,
modified_ts TEXT,
dt TEXT);
CREATE TRIGGER files_trig AFTER INSERT ON files
BEGIN
update files SET created_ts = datetime('now','localtime') WHERE id = NEW.id;
END;
CREATE TRIGGER files_update_trig AFTER UPDATE ON files
BEGIN
update files SET modified_ts = datetime('now','localtime') WHERE id = OLD.id;
insert into files_log(fileid, name, content, created_ts, modified_ts)
values(OLD.id, OLD.name, OLD.content, OLD.created_ts, OLD.modified_ts);
END;
CREATE TRIGGER files_log_update_trig AFTER INSERT ON files_log
BEGIN
update files_log SET dt = datetime('now', 'localtime') WHERE id = NEW.id;
END;
COMMIT;
Comments
Post a Comment