1
0
Fork 0
mirror of synced 2024-09-24 21:31:17 +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}`) 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 => { const standardWrap = (select: string): Knex.QueryBuilder => {
subQuery = subQuery.select(`${toAlias}.*`) subQuery = subQuery.select(`${toAlias}.*`)
@ -1018,11 +1016,7 @@ class InternalBuilder {
) )
break break
case SqlClient.MY_SQL: case SqlClient.MY_SQL:
wrapperQuery = addCorrelatedWhere( wrapperQuery = knex.raw(`json_arrayagg(json_object(${fieldList}))`)
standardWrap(`json_arrayagg(json_object(${fieldList}))`),
isManyToMany ? fromKey! : toKey!,
correlatedFrom
)
break break
case SqlClient.ORACLE: case SqlClient.ORACLE:
wrapperQuery = standardWrap( wrapperQuery = standardWrap(