Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
while (true) {
let nextFetch: number;
try {
nextFetch = await nextFetchPromise;
}
catch (e) {
if (rows.length == 0)
throw e;
else {
this.delayedError = e;
return { finished: false, rows };
}
}
if (nextFetch == fb.Status.RESULT_OK) {
const buffer1 = buffer;
buffer = ++buffer % 2;
const finish = options && options.fetchSize && rows.length + 1 >= options.fetchSize;
if (!finish)
nextFetchPromise = this.resultSetHandle!.fetchNextAsync(status, buffers[buffer]);
rows.push(await this.statement.dataReader(this.statement.attachment, this.transaction, buffers[buffer1]));
if (finish)
return { finished: false, rows };
}
else {
return { finished: true, rows };
}
return await this.attachment.client.statusAction(async status => {
const readingBytes = Math.min(buffer.length, MAX_SEGMENT_SIZE);
const segLength = new Uint32Array(1);
const result = await this.blobHandle!.getSegmentAsync(status, readingBytes, buffer, segLength);
if (result == fb.Status.RESULT_NO_DATA)
return -1;
return segLength[0];
});
}