Can't catch prepared statement failure
See original GitHub issueconst ps = new sql.PreparedStatement()
ps.input('param', sql.Int)
ps.prepare('select non-exisiting-column from table_name where phone = @phone')
.then(() => {
// fails with uncaughtException, never happens
}).catch(er => console.error(e)) // never happens
Fails with uncaughtException
Tried with plain promises
and async/await
[Error: [Microsoft][SQL Server Native Client 11.0][SQL Server]Statement(s) could not be prepared.] {
sqlstate: '42000',
code: 8180
}
"mssql": "^6.0.1"
"msnodesqlv8": "^0.8.6",
SQL Server 2016
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
Prepared Statement Failing - java - Stack Overflow
I am using one that deletes data that works fine, but the insert one is not inserting any data into the data table...
Read more >Prepared Statements - Manual - PHP
A prepared statement can be executed repeatedly. Upon every execution the current value of the bound variable is evaluated and sent to the...
Read more >PREPARE Statement - MariaDB Knowledge Base
This means that if the new statement contains an error and cannot be prepared, an error is returned and no statement with the...
Read more >General error: 1615 Prepared statement needs to be re ...
This means when the parameters are passed to the query, attempts to inject SQL into them are blocked, since MySQL prepared statements are...
Read more >(The only proper) PDO tutorial - Treating PHP Delusions
Prepared statement is the only proper way to run a query, if any variable is going to be used in it. The reason...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
My conclusion is that msnodesqlv8 is emitting multiple error events under this scenario, this is a very difficult situation to handle as really we’d expect a connection to have a 1-1 query to error output. If a connection can output many errors then we don’t know when we can expect the errors to stop coming and when the connection can be safely released back to the pool.
I’m going to open an issue with the driver and see if I can get any advice. see https://github.com/TimelordUK/node-sqlserver-v8/issues/133
Fixed with #981