Created
July 4, 2022 15:20
-
-
Save kylemocode/5d2c5c04f78642d835d27b05f658c59f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 開始一個 transaction | |
await conn.query("BEGIN"); | |
// 執行更新 | |
const sqlU= "update seats set isbooked = 1, name = $2 where id = $1 and isbooked = 0" | |
const updateResult = await conn.query(sqlU,[id, name]); | |
// 結束 transaction | |
await conn.query("COMMIT"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment