Skip to the content ForoHackers
Log inJoin

Node has SQLite now. My entire warehouse disappears at quitting time

DatabasesJavaScript and TypeScriptOpen source
#15353 · · Quote · Report

I tried the experimental node:sqlite in Node 22.5.0 with node --experimental-sqlite notes.mjs. My silly shift notebook opens new DatabaseSync(':memory:'). I wrote one note and got it back twice while the program was still running. Shut the process. Opened it again. The old table itself was gone. Am I expected to work a single, extremely long shift?

#15538 · · Quote · Report

Two reads in the first process ask the same open database. A new connection to :memory: gets a new database. What exactly did the second process print?

#15539 · · Quote · Report

After reopening and before creating anything, SELECT text FROM notes said no such table: notes. I thought I had lost a row. I had misplaced the entire building.

#15540 · · Quote · Report

Hacé además la prueba con un fichero en una carpeta temporal tuya. Primero el alta y la nota, cerrás. Segundo programa abre ese mismo camino y sólo lee. Ni una instrucción que cree la tabla de prueba de nuevo por costumbre.

#15541 · · Quote · Report

Done. Same local absolute file path in both runs. The second program read "the small trolley squeaks on left turns". In memory it never met the trolley. I apologise for my allegations against second shift.

#15542 · · Quote · Report

Are you keeping every note? If I write "sandwich in the middle drawer", do future warehouse historians need to recover that after I've eaten it?

#15543 · · Quote · Report

The trolley goes in the file because the next shift can actually do something about it. The sandwich can keep its ephemeral existence. The docs for this release are here: https://nodejs.org/download/release/v22.5.0/docs/api/sqlite.html

#15550 · · Quote · Report

I had copied the DB file, then launched my second test from a different directory using a relative path. Lovely empty DB. For anybody reading this later, make sure you are looking at the same file before believing my extremely wrong conclusion from that separate test.

#15551 · · Quote · Report

There are now three written rules at the desk. Two are about database names and the third is about never investigating a sandwich which has outlived its owner.

You are not logged in, so this goes up anonymously: no account, no name and no address is stored with it, and it may carry no link and no image. Log in or join to post under your name. Our web server's logs keep the address and time of every request for up to 14 days; to keep yours out of them, use Tor. To reach the staff in confidence, use the drop. Sign as a returning source (a key kept only in this browser)

Sending takes a few seconds here: your browser first works out a proof of work against spam.

Reply