Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined parameter passed to PreparedStatementInfo.execute cause rollback to get stuck #3293

Open
dolphinxx opened this issue Dec 30, 2024 · 1 comment

Comments

@dolphinxx
Copy link

The following code gets stuck at conn.rollback(). If I change the undefined parameter to null(name is not nullable), it rolls back as expected. I know the parameters should not be undefined, but there is always a chance of accidents.

await conn.beginTransaction();
    try {
      const stmt = await conn.prepare("INSERT INTO foo(name)VALUES(?)");
      try {
        await stmt.execute([undefined]);
      } finally {
        await stmt.close();
      }
      console.log('commiting...');
      await conn.commit();
      console.log('committed.');
    } catch (e) {
      console.error(e);
      console.log('rolling back...');
      await conn.rollback();
      console.log('rolled back.');
    } finally {
      conn.release();
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@dolphinxx and others