@rozenmd I would like to use the url in the where clause. how do we reference the url?
@rozenmd I would like to use the url in the where clause. how do we reference the url?
request.url has the URL. I'd suggest reading the MDN docs on how to parse URLs (https://developer.mozilla.org/en-US/docs/Web/API/URL) and/or moving over to #workers-help for non-D1 specific questions

9/11/23, 2:36 PM

RETURNING
9/13/23, 8:59 PM
bun:sqlite instead of better-sqlite3.waitUntil for the data insertion in request A and immediately redirect to request B, or do I have to wait until the insert is complete before redirecting to request B?await returns the data is inserted. D1 is strongly consistent - read-your-own-writes - from within the same Worker invocation.await const d1_lookup_code = await c.env.DB.prepare(`SELECT id, program, details FROM my_codes WHERE code = ?`).bind(code).first();
await c.env.DB.prepare(`DELETE FROM my_codes WHERE code = ?`).bind(code).run();await c.env.DB.prepare(`DELETE FROM my_codes WHERE code = ? RETURNING *`).bind(code).run()await c.env.DB.prepare(`DELETE FROM my_codes WHERE code = ? RETURNING *`).bind(code).first()request.url