I have created PR #25, which adds a test to the test suite that demonstrates a case where the format functions fails to expand the SET statement in an otherwise valid multi-statement query
Summary:
Adds a failing test case demonstrating an issue where an object passed to SET ? in a previous statement in a multi-statement query is incorrectly formatted (resulting in an unintended [object Object] string), rather than being expanded properly into key-value pairs.
The failing code:
format("SET @foo = 1; INSERT INTO bar SET ?", [{ foo: 'bar' }]);
Expected:
SET @foo = 1; INSERT INTO bar SET foo = 'bar'
Result:
SET @foo = 1; INSERT INTO bar SET '[object Object]'
I have created PR #25, which adds a test to the test suite that demonstrates a case where the format functions fails to expand the SET statement in an otherwise valid multi-statement query
Summary:
Adds a failing test case demonstrating an issue where an object passed to
SET ?in a previous statement in a multi-statement query is incorrectly formatted (resulting in an unintended[object Object]string), rather than being expanded properly into key-value pairs.The failing code:
format("SET @foo = 1; INSERT INTO bar SET ?", [{ foo: 'bar' }]);Expected:
SET @foo = 1; INSERT INTO bar SET foo = 'bar'Result:
SET @foo = 1; INSERT INTO bar SET '[object Object]'