Ok, I did analyzed a little bit (I am a javascript newbie):
_.mapValues(global_drawerEditKeywordPcb_form_editKeywordPcb.data, v => v === '' ? null : v)
return following code:
{name_en: "multiplexer", name_de: "Multiplexer", alternative_en: "Mux", alternative_de: "Muxer", comment: null…}
The keys are without '-characters. This is why the update process works very fine.
In mysql there is no way to make an insert with key-value-pair. You have to sparate the value and the key in two lists.
To try a typical list, like:
_.map(_.keys(global_drawerAddKeywordPcb_form_addKeywordPcb.data))
returns ["name_en", "name_de", "alternative_en", "alternative_de", "comment", "dbComment", "dbAssigneeId", "dbStatusId"] and won't work. for the insert.
I found out there is a dataytpe Set. This could do the job like:
INSERT INTO eddy_db.definition_keyword_pcb(
{{ new Set(_.map(_.keys(global_drawerAddKeywordPcb_form_addKeywordPcb.data), v => v === '' ? null : v)) }},
createdById,
createdAt
)
values(
{{ _.map(_.values(global_drawerAddKeywordPcb_form_addKeywordPcb.data), v => v === '' ? null : v) }},
{{ global_var_appUser_userId.value }},
CURRENT_TIMESTAMP
);
But this won't work, too. The error message looks like: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ', createdById, createdAt ) values( 'dsfdf', 'sfddf', NULL, NULL, NULL, ' at line 2". It seems the Set is empty like {}.
If I place it in a tansformer I got the following message, I can't realize: