sidorares / node-mysql2

:zap: fast mysqljs/mysql compatible mysql driver for node.js
https://sidorares.github.io/node-mysql2/
MIT License
3.94k stars 593 forks source link

PoolConnection.execute() retrun object v3.9.7 #2630

Closed PeterGamez closed 2 weeks ago

PeterGamez commented 2 weeks ago
const [rows] = await PoolConnection.execute(sql)

rows are return datatype object

[
  [Object: null prototype] {
    ...
  }
]

on 3.9.6 are retrun datatype array

sidorares commented 2 weeks ago

yes, we moved from base {} to Object.create(null) in 3.9.4 but then had to partially revert that due to #2585 via #2591

Is this breaking something on your side @PeterGamez ?

PeterGamez commented 2 weeks ago

@sidorares yes, how i can fix

sidorares commented 2 weeks ago

Sorry @PeterGamez I still don't understand what issue you are trying to fix

PeterGamez commented 2 weeks ago

@sidorares on rows it return datatype object, i want return datatype array

wellwelwel commented 2 weeks ago
[
  [Object: null prototype] {
    ...
  }
]

This isn't actually the expected behavior.

For example, we check if the properties are safe and, if so, we create a standard object:

https://github.com/sidorares/node-mysql2/blob/1469228310c4507965a9c674fcdaaa075e185579/lib/parsers/binary_parser.js#L125

https://github.com/sidorares/node-mysql2/blob/1469228310c4507965a9c674fcdaaa075e185579/lib/parsers/text_parser.js#L134


Could you show an example of how you are returning a null object? Maybe updating node_modules could be a valid check 🙋🏻‍♂️

PeterGamez commented 2 weeks ago
[
  [Object: null prototype] {
    ...
  }
]

This isn't actually the expected behavior.

For example, we check if the properties are safe and, if so, we create a standard object:

  • execute

https://github.com/sidorares/node-mysql2/blob/1469228310c4507965a9c674fcdaaa075e185579/lib/parsers/binary_parser.js#L125

  • query

https://github.com/sidorares/node-mysql2/blob/1469228310c4507965a9c674fcdaaa075e185579/lib/parsers/text_parser.js#L134

Could you show an example of how you are returning a null object? Maybe updating node_modules could be a valid check 🙋🏻‍♂️

update node_modules are work