Ensure converter functions are run in the correct order

This commit is contained in:
Sharad Chandran R 2023-05-03 20:01:22 +05:30
parent f590b5bb51
commit 3e65b9894f
1 changed files with 12 additions and 12 deletions

View File

@ -161,18 +161,6 @@ class ResultSet {
}
}
// create objects, if desired
if (this._impl.outFormat === constants.OUT_FORMAT_OBJECT) {
for (let i = 0; i < rows.length; i++) {
const origRow = rows[i];
const newRow = rows[i] = {};
const metaData = this._impl.metaData;
for (let j = 0; j < metaData.length; j++) {
newRow[metaData[j].name] = origRow[j];
}
}
}
// run any conversion functions, if applicable
// NOTE: we mark the connection as no longer in progress before making
// calls to the converter function; this is needed to allow calls against
@ -194,6 +182,18 @@ class ResultSet {
}
}
// create objects, if desired
if (this._impl.outFormat === constants.OUT_FORMAT_OBJECT) {
for (let i = 0; i < rows.length; i++) {
const origRow = rows[i];
const newRow = rows[i] = {};
const metaData = this._impl.metaData;
for (let j = 0; j < metaData.length; j++) {
newRow[metaData[j].name] = origRow[j];
}
}
}
}
//---------------------------------------------------------------------------