node-sqlite icon indicating copy to clipboard operation
node-sqlite copied to clipboard

In a result row, if two fields have the same name, one of the values gets stomped.

Open sconover opened this issue 14 years ago • 0 comments

This is more a "discussion" than an issue.

node-sqlite faithfully implements the row-as-map style expressed in the w3c spec. This is convenient for js programmers as rows are just js objects.

However if you consider a query like:

"select foo.color, bar.color from foo natural join bar"

Since each row is a map, and the key is the field name (i.e. not fully-qualified) every row in the resulting rowset will have only bar.color's value.

A clean way to handle this problem would be to have an alternative row format - that's just the values in an array in proper order, i.e. an array of values instead of the convenient js object. I'd be wiling to brush off my ancient C++ skillz and take a shot at such a thing, but I'd like some guidance / suggestion on how the api should look before I do that...the "query" method seems to be overridden to begin with, so I'm not sure where would be a good place to drop in something like a map of options ( {rowStyle:"array"} ).

Thoughts?

sconover avatar Feb 16 '11 17:02 sconover