From a2d1c179f88e056265321b426a51907a3941044a Mon Sep 17 00:00:00 2001 From: akiyamn Date: Wed, 4 Oct 2023 23:29:19 +1100 Subject: Kind of works --- src/store.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/store.ts (limited to 'src/store.ts') diff --git a/src/store.ts b/src/store.ts new file mode 100644 index 0000000..9e98254 --- /dev/null +++ b/src/store.ts @@ -0,0 +1,10 @@ +import { ProductInfo } from "./gather"; + +export async function storePriceRecord(db: D1Database, product: ProductInfo): Promise { + const query = 'INSERT INTO Prices (CompanyName, ProductName, Price, AccessDate, Picture) VALUES (?1, ?2, ?3, ?4, ?5)' + const { results, success } = await db.prepare(query) + .bind(product.companyName, product.productName, product.price, product.accessDate, product.picture) + .run(); + console.log(results, success) + return success +} \ No newline at end of file -- cgit v1.2.3