Skip to content

Table cannot add column named "nodes" #391

Open

Description

@alexhrescale

Version: 0.78.0 via npm install sql

As a consequence of the nodes getter , https://github.com/brianc/node-sql/blob/master/lib/table.js#L253 (but for the npm install it is table.js:L48),

Table.prototype.__defineGetter__("nodes", function() {

if one runs e.g.

const sql = require("sql");
var tbl = new sql.Table({});
tbl.addColumn("nodes");

it will throw

table.js:124 Uncaught TypeError: Cannot set property nodes of #<Table> which has only a getter(…)

as it tries to call, in https://github.com/brianc/node-sql/blob/master/lib/table.js#L124

this[property] = this[property] || col;

To get around this, one can run

tbl.columns.push(tbl.createColumn("nodes"))
tbl.columns[0].name // "nodes"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions