pool.createReadStream() does not return column names
Closed this issue · 2 comments
Hello guys,
I have problem with the following function, it does not return column names + values, instead it returns an array of column values.
pool.createReadStream("SELECT * FROM FOO")
And then i print the values row by row
stream.on('data', function(data) {
//Returns an array of column values but no column names.
console.log(data);
})
Are there any way to get the column names aswell? As an alternative solution i can create an array with columns i want in my select and value them by index, but yeah... I'm not a fan of that solution lol.
Kindly regards
Developer note: it may be possible to modify this code to return the meta data of the result set.
ResultSetMetaData rsmd = rs.getMetaData();
String name = rsmd.getColumnName(1);
However, from your standpoint if you're not looking to modify the source library your best bet is probably just to query the table and get the first row, which will give column names, right?
Hello cwg999,
Thanks for your reply you are right i could just edit the source code, didn't thought of that, thanks!