Open
Description
I would like to be able to access fields by their index in the query, without having to modify the query to include an 'AS' field alias. For example, given:
SELECT COUNT(*), MAX(some_field) + 1 FROM table
I want to be able to refer to the results like this:
const count = rows[0][0];
const max_thingy = rows[0][1];
Instead of:
const count = rows[0]['COUNT(*)'];
const max_thingy = rows[0]['MAX(some_field) + 1'];
You can imagine how these field names can get very long and unwieldy.
The solution is to add one line to the end of the for
loop in the parse
function of RowDataPacket
(after line 49 in the current code):
Object.defineProperty(this, i, { value });
Metadata
Metadata
Assignees
Labels
No labels