nodejs + oracledb Undefined result

Asked

Viewed 22 times

1

I need help with a Function no nodejs.

oracle js file.

const oracledb = require("oracledb")
const dbconfig = dbConfig = require('../database/dbconfig.js');


 oracledb.getConnection({
    user : dbConfig.dbuser,
    password : dbConfig.dbpassword,
    connectString : dbConfig.connectionString
},
async function(err,connection)
{if (err){
    console.log(err.message);
    return;
}
await connection.execute(
    'select * from tc_user_logistica',[],{ outFormat: oracledb.OBJECT},
    
   async function(err,result)
    {
        if(err){
            console.error(err,message);
            doRelease(connection);
            return;
        }
        //console.log(result.rows);
        rows = result.rows;
        console.log(rows)
        return;
    });

});

file auth.js:

    const bcrypt = require('bcryptjs');
const LocalStrategy = require('passport-local').Strategy;
const userOracle = require('./routes/oracle')
//var usuarios = [userOracle]
//console.log(usuarios)



var users = userOracle
console.log(users)

the problem is that it returns a result {} before the expected result([ { uid: 1, username: 'teste1', password: '123' }, { uid: 2, username: 'teste2', password: '123' } ]) how to make this someone can help me?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.