|
1 |
| -/* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. */ |
| 1 | +/* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. */ |
2 | 2 |
|
3 | 3 | /******************************************************************************
|
4 | 4 | *
|
@@ -65,26 +65,29 @@ oracledb.getConnection(
|
65 | 65 | doRelease(connection);
|
66 | 66 | return;
|
67 | 67 | }
|
68 |
| - console.log(result); |
| 68 | + // console.log(result); |
69 | 69 | fetchRowsFromRS(connection, result.resultSet, numRows);
|
70 | 70 | });
|
71 | 71 | });
|
72 | 72 |
|
73 | 73 | function fetchRowsFromRS(connection, resultSet, numRows)
|
74 | 74 | {
|
75 |
| - resultSet.getRows( // get numRows rows |
76 |
| - numRows, |
| 75 | + resultSet.getRows( |
| 76 | + numRows, // get this many rows |
77 | 77 | function (err, rows)
|
78 | 78 | {
|
79 | 79 | if (err) {
|
80 |
| - console.log(err); |
81 |
| - doClose(connection, resultSet); // always close the result set |
82 |
| - } else if (rows.length === 0) { // no rows, or no more rows |
| 80 | + console.error(err); |
83 | 81 | doClose(connection, resultSet); // always close the result set
|
84 | 82 | } else if (rows.length > 0) {
|
85 | 83 | console.log("fetchRowsFromRS(): Got " + rows.length + " rows");
|
86 | 84 | console.log(rows);
|
87 |
| - fetchRowsFromRS(connection, resultSet, numRows); |
| 85 | + if (rows.length === numRows) // might be more rows |
| 86 | + fetchRowsFromRS(connection, resultSet, numRows); |
| 87 | + else |
| 88 | + doClose(connection, resultSet); // always close the result set |
| 89 | + } else { // no rows |
| 90 | + doClose(connection, resultSet); // always close the result set |
88 | 91 | }
|
89 | 92 | });
|
90 | 93 | }
|
|
0 commit comments