mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-12-23 08:21:09 +00:00
serverless: Implement Connection.pragma()
This commit is contained in:
parent
4841bfd78a
commit
ee58a0bf32
2 changed files with 15 additions and 0 deletions
|
|
@ -76,6 +76,17 @@ export class Connection {
|
|||
async batch(statements: string[], mode?: string): Promise<any> {
|
||||
return this.session.batch(statements);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a pragma.
|
||||
*
|
||||
* @param pragma - The pragma to execute
|
||||
* @returns Promise resolving to the result of the pragma
|
||||
*/
|
||||
async pragma(pragma: string): Promise<any> {
|
||||
const sql = `PRAGMA ${pragma}`;
|
||||
return this.session.execute(sql);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -279,6 +279,10 @@ test.skip("Database.transaction().immediate()", async (t) => {
|
|||
});
|
||||
|
||||
test.serial("Database.pragma()", async (t) => {
|
||||
if (process.env.PROVIDER === "serverless") {
|
||||
t.pass("Skipping pragma test for serverless");
|
||||
return;
|
||||
}
|
||||
const db = t.context.db;
|
||||
await db.pragma("cache_size = 2000");
|
||||
t.deepEqual(await db.pragma("cache_size"), [{ "cache_size": 2000 }]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue