Curious about the future of data-driven systems? Join our Data Engineering roundtable and learn how to build scalable data platforms.
Data Engineering: The industry has come a long way from organizing unstructured data to adopting today's modern data pipelines. See how.
Developer Advocate at Oracle
Brooklyn, US
Joined Jul 2017
@dmcghan
Stats
| Reputation: | 980 |
| Pageviews: | 950.4K |
| Articles: | 22 |
| Comments: | 4 |
Comments
Apr 04, 2019 · Dan McGhan
It seems like something wasn't copied over from the source correctly. I added the missing code. If you find something else missing, check out the original post here: https://jsao.io/2017/07/how-to-get-use-and-close-a-db-connection-using-async-functions/
Jul 10, 2018 · Dan McGhan
Here's a gist to show you how it could work.
Jan 18, 2018 · Dan McGhan
The callback does not mean return. That's just a function, like any other, being invoked. When that happens a new function is added to the call stack and executed. When complete, the lines following that call will be executed (which is why we need to return).
Why not try running the code and experimenting with commenting the line out? Use this to get started: https://dzone.com/articles/creating-a-sandbox-for-learning-nodejs-and-oracle
Jan 18, 2018 · Dan McGhan
The return statement exits the function. Without that, the logic that follows the if statement would execute - but that logic assumes that a connection has been successfully obtained.