MySQL Forums
Forum List  »  Connector/Node.js

Re: Unexpected NULL Fields errors when updating or inserting record - MySQL XDevAPI NodeJs Connector 8.0.23
Posted by: Rui Quelhas
Date: March 08, 2021 04:58AM

Hi Kevin,

this was sort of intended (https://bugs.mysql.com/bug.php?id=100425). Not providing any value is the same as providing a JavaScript "undefined" which means that the value isn't defined, whilst a JavaScript "null" means the value is indeed defined but is null/empty (different meaning). We can argue wether JavaScript "undefined" should map to a SQL "NULL" given the nature of the later, but from an API standpoint, this distinction and the semantics can be important, for instance:

func1() === func1(undefined)
func1() !== func1(null)

func2('foo') === func2('foo', undefined)
func2('foo') !== func2('foo', null)

func3('foo', 'bar') === func3('foo', 'bar', undefined)
func3('foo', 'bar') !== func3('foo', 'bar', null)

The workaround is to provide those "null" values where they need to be provided.

In the end, this was a design decision, which does not mean it cannot be reverted. If you are interested in that, I suggest you report the issue (under the "Connector for Node.js" category) using the MySQL public bug tracker (https://bugs.mysql.com/).

Hope it helps

Thanks

Options: ReplyQuote


Subject
Written By
Posted
Re: Unexpected NULL Fields errors when updating or inserting record - MySQL XDevAPI NodeJs Connector 8.0.23
March 08, 2021 04:58AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.