mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-18 17:14:20 +01:00
serverless: Implement Connection.pragma()
This commit is contained in:
@@ -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 }]);
|
||||
|
||||
Reference in New Issue
Block a user