Created
January 26, 2018 12:32
-
-
Save maiquealmeida/68db91295f0dda1c9380c2c1c7377008 to your computer and use it in GitHub Desktop.
Estrutura basica para consultas utilizando NodeJS e Oracle.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let connection = null; | |
try { | |
connection = await oracledb.getConnection(config.database); | |
let result = await connection.execute("...", {}, {outFormat: oracledb.OBJECT}); | |
... | |
} catch (err) { | |
// Envia uma resposta JSON relatando o erro. | |
databaseException(err, res, err.message); | |
} finally { | |
// Release the connection | |
if (connection) { | |
await connection.release( | |
function (err) { | |
if (err) { | |
console.error(err.message); | |
} else { | |
// console.log("Connection released"); | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment