Skip to content
Advertisement

SQLite table is only able to hold 1 row?

So, I have 2 tables, that I’ve added per the documentation, but something weird happens whenever I try to add a row to them. The data is written into the .db file, but whenever I query it, it only returns the first row. I can still update, and read these rows normally, but any data I write to them, just doesn’t update the table. It’s only the first row that get’s written.

I’ve looked over all my statements, and I know they’re right, since the first statement adds it to the table, but the second doesn’t. I’m using the base configuration of sqlite3 from npm, per the docs, so I don’t know what I’m doing wrong.

I don’t have any errors, and the expected result, is that I’m able to add as many rows as I can

Also, this is not an asynchronous problem. In the example, I added the last line, but it’s not actually in my code. I’m requesting it minutes later, and I can confirm the text is in the database, it just decides not to read it.

Advertisement

Answer

Turn out I needed to use db.all. db.get returns only the first row.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement