I have a big problem with recursion, callback and nodejs.
I have this object for exemple :
var a= [
{index : 1},
{index : 2},
{index : [
{index : 11},
{index : 12},
{index : [
{index : 111},
{index : 112},
{index : "end-of-tree"},
]},
]},
{index : 4},
]
And I would like to display sequentially this:
1
2
11
12
111
112
end-of-tree
4
with console.log(value)
In pure javascript it's easy but as node run asynchronously, it's a bit more complicated.
Who could help me ?
I manage to get it to work.
JSON exemple :
Javascript code :
Console Log result :
You could try something simpler like this!
In fact your problem doesn't have anything asynchronous it is a synchronous itteration in an array!
@alex-rocabillis.... https://github.com/oracle/node-oracledb/blob/master/doc/api.md#-523-execute
oracle execute fonction is asynchronous. I gonna create an other post to explain the problem.
5.2.3 execute()
Prototype
void execute(String sql, [Object bindParams, [Object options,]] function(Error error, [Object result]){}); Return Value
None
Description
This call executes a SQL or PL/SQL statement. See SQL Execution for examples.
This is an asynchronous call.
The statement to be executed may contain IN binds, OUT or IN OUT bind values or variables, which are bound using either an object or an array.
A callback function returns a result object, containing any fetched rows, the values of any OUT and IN OUT bind variables, and the number of rows affected by the execution of DML statements.
Parameters