Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Small optimization

  • Loading branch information...
commit 61ed1cc3633f3656a25571f3c1867e627a861f58 1 parent 0dca682
@mariano authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 query.cc
View
5 query.cc
@@ -746,7 +746,8 @@ int node_db::Query::eioExecuteFinished(eio_req* eioRequest) {
if (!isEmpty) {
assert(request->rows);
- v8::Local<v8::Array> rows = v8::Array::New(request->rows->size());
+ size_t totalRows = request->rows->size();
+ v8::Local<v8::Array> rows = v8::Array::New(totalRows);
uint64_t index = 0;
for (std::vector<row_t*>::iterator iterator = request->rows->begin(), end = request->rows->end(); iterator != end; ++iterator, index++) {
@@ -756,7 +757,7 @@ int node_db::Query::eioExecuteFinished(eio_req* eioRequest) {
eachArgv[0] = row;
eachArgv[1] = v8::Number::New(index);
- eachArgv[2] = v8::Local<v8::Value>::New((index == request->rows->size() - 1) ? v8::True() : v8::False());
+ eachArgv[2] = v8::Local<v8::Value>::New((index == totalRows - 1) ? v8::True() : v8::False());
request->query->Emit(syEach, 3, eachArgv);
Please sign in to comment.
Something went wrong with that request. Please try again.