sqbjs/sqb

Data insertion failing without 'id' PK

mumincelal opened this issue · 1 comments

if id PK is not specified explicitly in the database, data insertion is failing and sqb is returning Unable to insert new row.

Database structure that causing insertion problem

Screen Shot 2021-04-05 at 15 45 22

When I debug the code marked as 1 and as 2 code lines the following picture is returning undefined.

Screen Shot 2021-04-05 at 15 54 17

Converted database structure that not causing insertion problem

Screen Shot 2021-04-05 at 15 46 35

if id is inserted into the database structure then like the above picture then marked as 1 and as 2 code lines are not returning undefined (returning id) and insertion completed successfully.

It seems your table has no primary key. So SQB can not fetch row after insert. If you add a primary key to your table it will work as expected.