Comparing version 0.4.12 to 0.4.13
@@ -24,2 +24,3 @@ /* SQB | ||
this._ignoreNulls = !!(options && options.ignoreNulls); | ||
this._limit = options ? options.limit : undefined; | ||
if (resultSet) | ||
@@ -85,3 +86,2 @@ this._open(resultSet); | ||
return self.once('open', () => self._read()); | ||
if (self._rowNum === 0) { | ||
@@ -102,3 +102,18 @@ self._rowNum++; | ||
if (self._resultSet.closed || self._resultSet._fetchedAll) { | ||
let fetchCount = self._resultSet ? self._resultSet._prefetchRows : 0; | ||
if (self._limit) | ||
fetchCount = Math.min(fetchCount, self._limit - self._rowNum + 1); | ||
if (self._fetchedAll || self._resultSet.closed || fetchCount <= 0) { | ||
if (!self._closed) { | ||
self._closed = true; | ||
const summary = { | ||
numRows: self._rowNum, | ||
eof: !(self._resultSet && !self._resultSet.eof) | ||
}; | ||
self.emit('summary', summary); | ||
let s = JSON.stringify(summary); | ||
s = s.substring(1, s.length - 1); | ||
s = s ? ',' + s : ''; | ||
self.push(']' + s + '}'); | ||
} | ||
self.push(null); | ||
@@ -109,7 +124,7 @@ return; | ||
if (self._fetchedRows && self._fetchedRows.length) { | ||
self._rowNum++; | ||
self._pushRow(self._fetchedRows.shift()); | ||
self._rowNum++; | ||
} else { | ||
const fetchCount = self._resultSet._prefetchRows; | ||
self._resultSet.next({ | ||
@@ -129,6 +144,6 @@ fetchCount, | ||
if (!rows) { | ||
self.push('], "numRows": ' + String(self._rowNum) + '}'); | ||
self._fetchedAll = true; | ||
} else { | ||
self._rowNum++; | ||
self._pushRow(self._fetchedRows.shift()); | ||
self._rowNum++; | ||
} | ||
@@ -135,0 +150,0 @@ }); |
{ | ||
"name": "sqb", | ||
"description": "Plugin-driven, multi-dialect SQL query builder and Database connection framework for JavaScript", | ||
"version": "0.4.12", | ||
"version": "0.4.13", | ||
"author": "Panates Ltd.", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
90026
3051