Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return results as one array when row length is unknown #158

Closed
bchr02 opened this issue Aug 8, 2015 · 3 comments
Closed

return results as one array when row length is unknown #158

bchr02 opened this issue Aug 8, 2015 · 3 comments

Comments

@bchr02
Copy link

bchr02 commented Aug 8, 2015

There are situations where one might want their query results returned as one array even when the number of rows are unknown. While there is no arguing that trying to disseminate the data as it is pulled from OCI will yield better performance, sometimes it's not a practical thing to do. Reasons might have to do with one or more of the following: resources, dependencies, time, and or needs.

Currently, there is no built-in method to accommodate this scenario. This leaves the consumer to have to do one of two things:

1. use a non-resultSet and set a high maxRows.
The main issue with this approach is that it will force you to have to assign a much higher value to numRows then what you would expect the query to output which will lead to unneeded higher memory utilization.

2. use a resultSet and accumulate the data
I think this is a hassle to do and it would likely be achieved more efficiently if the driver accommodated it first hand. It seems like a basic thing to ask for; getting your data from the driver in one array.

Other comments:
This feature request started from the following post: #65 (comment) More information and past discussions can be found there.

Also, for anyone interested, @bjouhier was kind enough to put together the following gist which should assist anyone trying to deal with this issue.

@cjbj
Copy link
Member

cjbj commented Aug 8, 2015

@bchr02 thanks for splitting this into a separate issue.

@bchr02
Copy link
Author

bchr02 commented Aug 9, 2015

Absolutely. Glad to help.

@cjbj
Copy link
Member

cjbj commented Dec 12, 2017

@bchr02 I've pushed the code for this to the dev-2.0 branch. See https://github.com/oracle/node-oracledb/blob/dev-2.0/doc/api.md#propdbmaxrows and https://github.com/oracle/node-oracledb/blob/dev-2.0/doc/api.md#propdbfetcharraysize

@anthony-tuininga has some thoughts about moving some processing to JS, which for some reason seems to be a bit more efficient than via NAN in C++; this is a post 2.0.15 task.

@cjbj cjbj closed this as completed Dec 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants