Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table cannot add column named "nodes" #391

Open
alexhrescale opened this issue Mar 9, 2018 · 0 comments
Open

Table cannot add column named "nodes" #391

alexhrescale opened this issue Mar 9, 2018 · 0 comments

Comments

@alexhrescale
Copy link

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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant