tursodatabase / tursodatabase/libsql-client-ts
Excecute only runs the first statement
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 576
- Forks
- 69
- PR merge metrics
- No merged PRs in 30d
Description
Consider the following code
import { createClient } from "@libsql/client";
const file_name = process.cwd() + "/test.db";
const db_url = "file:" + file_name;
const db_client = createClient({
url: db_url,
});
const rs = await db_client.execute(
"CREATE TABLE a(a1 integer); CREATE TABLE b(b1 integer);"
);
console.log(rs);
Only the table a is created. The second create statement is silently ignored.
This is different from what better-sqlite3 does.
Supporting multiple statements would be useful for
reading sql statements form a file as in the example at
https://github.com/WiseLibs/better-sqlite3/blob/master/docs/api.md#execstring---this
const migration = fs.readFileSync('migrate-schema.sql', 'utf8');
db.exec(migration);
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the db_client.execute entry point shown in the issue and compare its behavior with the linked better-sqlite3 exec example. Done means a single input containing both CREATE statements creates both tables and supports the requested SQL-file migration use case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, sqlite, typescript
- Domain
- database
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100