1
0
Fork 0
mirror of synced 2024-09-24 13:21:53 +12:00

Removing wrap for MySQL.

This commit is contained in:
mike12345567 2024-09-23 12:33:25 +01:00
parent efdfbe7229
commit b0252469ed

View file

@ -991,10 +991,8 @@ class InternalBuilder {
this.on(`${toAlias}.${toPrimary}`, "=", `${throughAlias}.${toKey}`)
})
}
// my-sql needs the where statement to be part of main query, not sub-query
if (sqlClient !== SqlClient.MY_SQL) {
subQuery = addCorrelatedWhere(subQuery, correlatedTo, correlatedFrom)
}
subQuery = addCorrelatedWhere(subQuery, correlatedTo, correlatedFrom)
const standardWrap = (select: string): Knex.QueryBuilder => {
subQuery = subQuery.select(`${toAlias}.*`)
@ -1018,11 +1016,7 @@ class InternalBuilder {
)
break
case SqlClient.MY_SQL:
wrapperQuery = addCorrelatedWhere(
standardWrap(`json_arrayagg(json_object(${fieldList}))`),
isManyToMany ? fromKey! : toKey!,
correlatedFrom
)
wrapperQuery = knex.raw(`json_arrayagg(json_object(${fieldList}))`)
break
case SqlClient.ORACLE:
wrapperQuery = standardWrap(