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.

INSERT INTO - Result callback?

See original GitHub issue

Hello

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:open
  • Created 6 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
felipezacanicommented, Sep 30, 2019

Can it be that this is still an issue?

Yes, it is.

1reaction
paulishcommented, Oct 13, 2017

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.

Read more comments on GitHub >

github_iconTop 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 >

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