Skip to content

Commit

Permalink
[misc] correcting array size initialization (issue 15 from BufoViridis)
Browse files Browse the repository at this point in the history
  • Loading branch information
rusher committed Oct 1, 2018
1 parent 6d3dd8b commit 8a5601b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/cmd/query.js
Expand Up @@ -425,7 +425,7 @@ class Query extends ResultSet {
parseRow(columns, packet, connOpts) {
let row;
if (this.opts.rowsAsArray) {
row = [columns.length];
row = new Array(columns.length);
for (let i = 0; i < columns.length; i++) {
row[i] = this._getValue(i, columns[i], this.opts, connOpts, packet);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/cmd/resultset.js
Expand Up @@ -197,7 +197,7 @@ class ResultSet extends Command {
// last column
if (this._receivedColumnsCount === this._columnCount) {
if (!this.opts.rowsAsArray) {
this.tableHeader = [this._columnCount];
this.tableHeader = new Array(this._columnCount);
if (typeof this.opts.nestTables === "string") {
for (let i = 0; i < this._columns.length; i++) {
this.tableHeader[i] =
Expand Down
2 changes: 1 addition & 1 deletion lib/misc/utils.js
Expand Up @@ -14,7 +14,7 @@ module.exports.log = function(opts, buf, off, len, header) {
let out = [];

if (!buf || len !== 0) {
let asciiValue = [16];
let asciiValue = new Array(16);
asciiValue[8] = " ";

let useHeader = header !== undefined;
Expand Down

0 comments on commit 8a5601b

Please sign in to comment.