INSERT INTO - Result callback?
See original GitHub issueHello
I am trying to write a function that lets me insert a value into the firebird database. The query works well, only I get no callback to tell me that the insert went well.
It is the first time I am using a firebird connector. In the past, when using mySql connectors I can recall having some sort of callback.
I tried adding ‘RETURNING FEATURE_ID’ at the end, but an error “Cursor is not open” was thrown. Any advice would be very kind.
pool.get(function(err, db) {
if (err) {
console.log(err)
res.send(403)
}
else {
var date = moment(req.body.date, "DD/MM/YYYY")
var values = " VALUES ('" + date.format("MM/DD/YYYY") + "','Requested','" + req.body.type + "','" + req.body.description + "','" + req.body.memo +"')"
var query = 'INSERT INTO "Features" (FEATURE_REQUESTDATE, FEATURE_STATUS, FEATURE_TYPE, FEATURE_DESCRIPTION, FEATURE_MEMO)' + values
db.query( query , function(err, result) {
if (result) {
res.status(200)
res.send('ok')
}
if (err) {
console.log(err)
res.status(403)
res.send('error')
}
})
db.detach();
}
})
The FEATURE_ID column is automatically generated using an insert trigger.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Node.js query INSERT callback not working as expected
I have used the code without the callback and it is returning a 500 error. Although the data is getting saved in the...
Read more >MongoDB Async Driver Quick Tour - GitHub Pages
To insert the document into the collection, use the insertOne() method. collection.insertOne(doc, new SingleResultCallback<Void>() { @Override public void ...
Read more >DML with MariaDB Connector/Node.js and Callback API
Connect to MariaDB Server from Node.js application using Callback API with ... To update or delete data, replace the INSERT statement in the...
Read more >Advanced Callbacks | Dash for Python Documentation | Plotly
It is possible for a callback to insert new Dash components into a Dash app's layout. If these new components are themselves the...
Read more >Inserting Data Into an SQLite Table from a Node.js Application
The run() method executes an INSERT statement with specified parameters and calls a callback afterwards. If an error occurred, you can find the...
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
Yes, it is.
This is critical only if you have Firebird 3 (works fine with 2.5). At the same time you can workaround issue in most of cases by 2 queries: 1) select id from generator / procedure 2) insert with previously selected and saved value.