question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

What is the proper way to use `Transaction` with multiple prepared queries

See original GitHub issue

I’m trying to create a transaction of multiple prepared statements inside

  1. It’s TypeScript code:
const request = new Request (transaction ? transaction : pool);
 /* or  */ 
const stmt =  new PreparedStatement(transaction ? transaction : pool);
const query = ``;

TS compiler complaints about Request can’t get ConnectionPool | Transaction type. So I can’t continue to develop because of these errors

  1. I can’t find proper examples in the docs of using transactions with multiple prepared statements And maybe TS examples
  • NodeJS: 12.8
  • node-mssql: 5.1.0
  • msnodesqlv8: 0.8.3
  • SQL Server: 16

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
Doc999torcommented, Aug 12, 2019

Ok, I’ll block the TS complaining and try it If it succeeds, I’ll send a PR to docs with an example Thanks

0reactions
dhensbycommented, Nov 3, 2019

closing this as stale

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Prepared Statements - JDBC Basics - Oracle Help Center
This JDBC Java tutorial describes how to use JDBC API to create, insert into, update, and query tables. You will also learn how...
Read more >
php - PDO: How can I run multiple prepared statements in a ...
Examine the storage engine for the table you are trying to perform transactions on to ensure that it in fact supports transactions.
Read more >
Multi-statement transactions | BigQuery - Google Cloud
A multi-statement transaction lets you perform mutating operations, such as inserting or deleting rows on one or more tables, and either commit or...
Read more >
Using Prepared Statements - Go database/sql tutorial
To use a prepared statement prepared outside the transaction in a Tx , you can use Tx.Stmt() , which will create a new...
Read more >
How to execute 1000s INSERT/UPDATE queries with PDO?
The key to have your multiple inserts fast and reliable is to use **transactions** and a **prepared statement**.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found