tursodatabase / libsql-client-ts

TypeScript/JavaScript client API for libSQL
https://docs.turso.tech/sdk/ts/quickstart
MIT License
182 stars 30 forks source link

read mode allows inserts & more #188

Open tmcw opened 3 months ago

tmcw commented 3 months ago

Quick demo:

import { createClient } from "@libsql/client";

const client = createClient({
  url: ":memory:",
});

console.log(
  await client.batch(
    ["CREATE TABLE x(y)", "INSERT INTO x(y) VALUES (1)", "SELECT * from x"],
    "read",
  ),
);

This probably shouldn't be possible. It seems that this is also possible with a non-memory database. I can't really see whether read mode makes any difference to queries at all.