|
|
@ -97,7 +97,7 @@ class BaseModelSqlv2 { |
|
|
|
|
|
|
|
|
|
|
|
await this.selectObject({ qb }); |
|
|
|
await this.selectObject({ qb }); |
|
|
|
|
|
|
|
|
|
|
|
qb.where(this.model.primaryKey.column_name, id); |
|
|
|
qb.where(_wherePk(this.model.primaryKeys, id)); |
|
|
|
|
|
|
|
|
|
|
|
const data = (await this.extractRawQueryAndExec(qb))?.[0]; |
|
|
|
const data = (await this.extractRawQueryAndExec(qb))?.[0]; |
|
|
|
|
|
|
|
|
|
|
@ -1826,12 +1826,16 @@ class BaseModelSqlv2 { |
|
|
|
// refer : https://www.sqlite.org/limits.html
|
|
|
|
// refer : https://www.sqlite.org/limits.html
|
|
|
|
const chunkSize = this.isSqlite ? 10 : _chunkSize; |
|
|
|
const chunkSize = this.isSqlite ? 10 : _chunkSize; |
|
|
|
|
|
|
|
|
|
|
|
const response = (this.isPg || this.isMssql) ? |
|
|
|
const response = |
|
|
|
await this.dbDriver |
|
|
|
this.isPg || this.isMssql |
|
|
|
|
|
|
|
? await this.dbDriver |
|
|
|
.batchInsert(this.model.table_name, insertDatas, chunkSize) |
|
|
|
.batchInsert(this.model.table_name, insertDatas, chunkSize) |
|
|
|
.returning(this.model.primaryKey?.column_name) : |
|
|
|
.returning(this.model.primaryKey?.column_name) |
|
|
|
await this.dbDriver |
|
|
|
: await this.dbDriver.batchInsert( |
|
|
|
.batchInsert(this.model.table_name, insertDatas, chunkSize); |
|
|
|
this.model.table_name, |
|
|
|
|
|
|
|
insertDatas, |
|
|
|
|
|
|
|
chunkSize |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
await this.afterBulkInsert(insertDatas, this.dbDriver, cookie); |
|
|
|
await this.afterBulkInsert(insertDatas, this.dbDriver, cookie); |
|
|
|
|
|
|
|
|
|
|
|