Saltar al contenido ForoHackers

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

Bases de datosJavaScript y TypeScriptCódigo abierto
#15353 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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 · · Citar · Denunciar

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.

No has iniciado sesión, así que esto se publica como anónimo: no se guarda con ello ninguna cuenta, nombre ni dirección, y no puede llevar enlaces ni imágenes. Inicia sesión o únete para publicar con tu nombre. Los registros de nuestro servidor web guardan la dirección y la hora de cada petición hasta 14 días; para que la tuya no quede en ellos, usa Tor. Para escribir al equipo de forma confidencial, usa el buzón. Firmar como fuente habitual (una clave guardada solo en este navegador)

Enviar tarda unos segundos aquí: tu navegador resuelve antes una prueba de trabajo contra el spam.

Responder