Skip to main content

Posts

Showing posts with the label sqlite

What Is Life?

Mon Jul 20 02:55:02 AM MDT 2026 I’m thinking again, life tends to feel like a bunch of bullshit at times. I don’t know what to do about that. It would be nice to be able to figure out whatever there is to figure out, but again I don’t know how to do that! I’m feel so fucking frustrated right now. I wish I had a clue about how to get over it, get through it, do something about it. But what can I do exactly? I don’t know. I don’t have a clue! It’s bugging the hell out of me right now. I wish I could do something about it, but again I don’t know what to do. Gah! What are you meant to do with this life when you just feel helpless? I wish I knew. I wish I could…do something about these feelings I am having at the moment. I don’t know what to do with them though? So many thoughts, emotions, feelings, all flooding into my head at once. Too much to focus on, too much to do anything with. I feel overwhelmed. What am I going to do about it? I need to figure out something. If I could do someth...

SQLite and Dates

Sometimes we want to store the date/time as an integer. It makes sense sometimes. If you want to run updates on everything higher than a certain number, you can do it quite easily with an integer. If you want to run everything all over again, compare it to zero. All records will be processed again. Easy peasy. Here’s how one of my tables looks to achieve this integer method for a date/time: CREATE TABLE notes( id INTEGER primary key, title TEXT, note_txt TEXT, created_dt INTEGER not null default (strftime('%s', 'now', 'localtime')), exported_flag INTEGER not null default 0 ); See how that works? Yeah, it’s pretty neat if I do say so myself. Of course you have to convert it to make it human readable. To do that, I usually do something like this: SELECT id, title, note_txt, created_dt, strftime('%Y-%m-%d %H:%M', created_dt) as formatted_dt FROM notes ORDER BY id DESC LIMIT 1 But, I can see what you’re thinking. Why do it...

SQLite Read File

There is a simple way to read a file into a SQLite database. The syntax looks like this: INSERT INTO images(name, img) VALUES('my_photo', readfile('photo.jpg')); Naturally you wouldn’t want to do this for very large files. The database would grow rather large I would expect and might become unmanagable. But for small files like icons? Things like that? Yeah I don’t see why not. Seems like such a simple little thing to do doesn’t it. Yeah, that’s what I was thinking.