Welcome Guest, Not a member yet? Register   Sign In
CTE with Query Builder
#1

(This post was last modified: 01-08-2024, 03:55 AM by ltarrant.)

Hi,

I have some quite complex queries to which I would like to introduce some Common Table Expressions to improve performance and simplify.

The existing queries are already written using the query builder with the benefit this brings of built-in injection protection and simplicity for applying business logic to build the query. So I am quite keen to still utilise the query builder and not manually build SQL strings to execute directly as a query.

Can any one point me in the right direction of how I might go about extending the BaseBuilder (taking a quick glance I think that's the class I should be looking at) to enable CTE support.

I was thinking along the lines of a new function that accepts a parameter with the CTE in the form of an instance of the BaseBuilder or RawSql to add after a WITH clause at the start of the subsequent query.

I fear it might be beyond my understanding framework setup but you never know.

Thanks,

Luke
Reply


Messages In This Thread
CTE with Query Builder - by ltarrant - 01-08-2024, 03:53 AM
RE: CTE with Query Builder - by InsiteFX - 01-08-2024, 11:54 AM
RE: CTE with Query Builder - by kilishan - 01-08-2024, 12:46 PM
RE: CTE with Query Builder - by ltarrant - 01-08-2024, 01:54 PM



Theme © iAndrew 2016 - Forum software by © MyBB