|
|
@ -1528,8 +1528,13 @@ class BaseModelSqlv2 { |
|
|
|
await this.validate(data); |
|
|
|
await this.validate(data); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// fallbacks to `10` if database client is sqlite
|
|
|
|
|
|
|
|
// to avoid `too many SQL variables` error
|
|
|
|
|
|
|
|
// refer : https://www.sqlite.org/limits.html
|
|
|
|
|
|
|
|
const chunkSize = this.isSqlite ? 10 : 50; |
|
|
|
|
|
|
|
|
|
|
|
const response = await this.dbDriver |
|
|
|
const response = await this.dbDriver |
|
|
|
.batchInsert(this.model.table_name, insertDatas, 50) |
|
|
|
.batchInsert(this.model.table_name, insertDatas, chunkSize) |
|
|
|
.returning(this.model.primaryKey?.column_name); |
|
|
|
.returning(this.model.primaryKey?.column_name); |
|
|
|
|
|
|
|
|
|
|
|
// await this.afterInsertb(insertDatas, null);
|
|
|
|
// await this.afterInsertb(insertDatas, null);
|
|
|
@ -1834,7 +1839,12 @@ class BaseModelSqlv2 { |
|
|
|
if (!validate) continue; |
|
|
|
if (!validate) continue; |
|
|
|
const { func, msg } = validate; |
|
|
|
const { func, msg } = validate; |
|
|
|
for (let j = 0; j < func.length; ++j) { |
|
|
|
for (let j = 0; j < func.length; ++j) { |
|
|
|
const fn = typeof func[j] === 'string' ? (customValidators[func[j]] ? customValidators[func[j]] : Validator[func[j]]) : func[j]; |
|
|
|
const fn = |
|
|
|
|
|
|
|
typeof func[j] === 'string' |
|
|
|
|
|
|
|
? customValidators[func[j]] |
|
|
|
|
|
|
|
? customValidators[func[j]] |
|
|
|
|
|
|
|
: Validator[func[j]] |
|
|
|
|
|
|
|
: func[j]; |
|
|
|
const arg = |
|
|
|
const arg = |
|
|
|
typeof func[j] === 'string' ? columns[cn] + '' : columns[cn]; |
|
|
|
typeof func[j] === 'string' ? columns[cn] + '' : columns[cn]; |
|
|
|
if ( |
|
|
|
if ( |
|
|
|