Description
I wish the requiremets for placeholders names matched the ones for js identifiers.
My project uses the local language in domain model identifiers, including some local non-ascii letters (æøå).
This works fine with with js/ts generally, but does not work with named placeholders.
This means I either have to let requirements from a specific persistence library pollute my core model, maintain an anti-corruption layer with redundant DTOs and mappers just for the spelling, or generate modified param objects on the fly (vulnerable to naming conflicts).
None of them are very tempting.
I would like to be able to do this:
const person:Person = {
...
født: 1972,
...
}
query (
`
UPDATE person
SET født=:født,
...
WHERE id = :id
`,
person
)
-but mysql2 fails to bind placeholders with non-ascii characters:
"Error: Bind parameters must not contain undefined. To pass SQL NULL specify JS null"
If I 'normalize' the field name/placeholder to "foedt", everything works fine