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

Question - INSERT INTO or CREATE TABLE from Node to 4D #10

Open
johanmorenolds opened this issue Mar 6, 2019 · 0 comments
Open

Question - INSERT INTO or CREATE TABLE from Node to 4D #10

johanmorenolds opened this issue Mar 6, 2019 · 0 comments

Comments

@johanmorenolds
Copy link

Hi Everybody, has anyone by any chance an example of how to create table and record records?

i have been trying to do it, but the problem that i am having right now is that it stays in a loop and never releases the sql connection. but the records and tables are created in 4D, the problem is that to terminate the process, and the connection i have to kill the node process.

this is a snippet of my code in case that you can see a problem with it

app.get('/addtodb',(req,res) => {
connection.connect( function( error ) {
if( error ) {
console.log( "Cannot connect to database: " + error );
return;
} else {
let sql = "INSERT INTO node4d (ID, Name) VALUES (1, 'Yohan')";
let query = connection.query( sql, (error,result) =>{// this is the point
if( error ) {
console.log( "Failed to run query: " + error );
return;
} else {
console.log( "post table created");
res.send('post table created');

            }
        } );
    }
} );

});

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

1 participant