data-api-client
data-api-client copied to clipboard
INSERT with parameters fails if less than 3 parameters
I've just encountered a very strange bug, which took me hours to figure out.
Apparently, if you execute an INSERT statement with parameters, it only works if the passed object contains more than 2 properties.
Fails with "cannot find parameter color_id";
dataAPI.query(
`INSERT INTO component (color_id, name)
VALUES(:color_id, :name)` ,{
color_id: 1,
name: "test"
})
Passes:
dataAPI.query(
`INSERT INTO component (color_id, name)
VALUES(:color_id, :name)` ,{
color_id: 1,
name: "test",
dummy: "dummy"
})
Unfortunately I have no idea what causes this.
@jeremydaly This is probably a semi-critical bug. It was fixed in PR #75 but hasn't been published to the npm registry, looks like.
+1
Why is this not on NPM yet?