Browse Source

fix: mysql single insert

pull/7352/head
mertmit 11 months ago
parent
commit
4068752de9
  1. 11
      packages/nocodb/src/db/BaseModelSqlv2.ts

11
packages/nocodb/src/db/BaseModelSqlv2.ts

@ -2364,8 +2364,10 @@ class BaseModelSqlv2 {
if (response?.length) { if (response?.length) {
id = response[0]; id = response[0];
} else { } else {
const res = await this.execAndParse(query); const res = await this.execAndParse(query, null, {
id = res?.id ?? res[0]?.insertId; raw: true,
});
id = res?.id ?? res[0]?.insertId ?? res;
} }
if (ai) { if (ai) {
@ -2727,11 +2729,8 @@ class BaseModelSqlv2 {
} else { } else {
rowId = await this.execAndParse(query, null, { rowId = await this.execAndParse(query, null, {
raw: true, raw: true,
first: true,
}); });
if (this.isMySQL) { rowId = rowId.id ?? rowId[0]?.insertId ?? rowId;
rowId = rowId?.insertId;
}
} }
if (ai) { if (ai) {

Loading…
Cancel
Save