You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because all table columns are added as closure properties, certain column names are incompatible with node-sql due to conflicting property names (table and alias, for example).
Initially, I thought that turning the columns list into an object to be used like the column name closure properties are would work, but then that would break the interface.
So, maybe making all of the non-column name attributes start with a "_" or something would work better?
I haven't pulled my sleeves up and really dug into the code yet, so I'm not sure what change would solve this with the least amount of "gotchas."
Thoughts?
The text was updated successfully, but these errors were encountered:
I'm having the same problem (managed to open a duplicate issue too :-))
Since there are just a few column names that are likely to cause collision, how about some kind of fudge where conflict column names are prefixed by some valid javascript but invalid SQL character, that is then truncated when crafting SQL?
eg:
var someTable = sql.define({
name 'someTable',
columns: ['join', 'abc']
});
someTable.select(someTable.abc, someTable.$join).from(someTable);
Because all table columns are added as closure properties, certain column names are incompatible with node-sql due to conflicting property names (table and alias, for example).
Initially, I thought that turning the columns list into an object to be used like the column name closure properties are would work, but then that would break the interface.
So, maybe making all of the non-column name attributes start with a "_" or something would work better?
I haven't pulled my sleeves up and really dug into the code yet, so I'm not sure what change would solve this with the least amount of "gotchas."
Thoughts?
The text was updated successfully, but these errors were encountered: