AddWith | Expect subviews | iOS library
kandi X-RAY | AddWith Summary
kandi X-RAY | AddWith Summary
Add subviews with its' subviews. Expect subviews' hierarchy at a look.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of AddWith
AddWith Key Features
AddWith Examples and Code Snippets
Community Discussions
Trending Discussions on AddWith
QUESTION
We have a query with a common structure that we use under different circumstances (where clause is different)
So we have something like this
...ANSWER
Answered 2021-Jan-29 at 08:56TL;DR: You can't use CTEs with jOOQ 3.15's model API
Some background on the jOOQ model API vs DSL API distinctionThe very old jOOQ 1.0 only had what is now called the "model API", a mutable, procedural API with setters (no getters), where you can manipulate dynamic SQL.
jOOQ 2.0 introduced the DSL API, which is what most people are using today. The fact that the DSL API mimicks the SQL language helps users discover jOOQ API much more easily. Everything is named exactly as expected. With the exception of a few quirks in the areas of CTE and derived tables, you can write jOOQ-SQL almost just like actual SQL.
The model API was not deprecated, but wrapped by the DSL API, and kept around:
- for backwards compatibility reasons
- because some people seemed to like the procedural approach
You can't do anything with the model API that you couldn't do with the DSL API as well, though a more functional programming style may be helpful when doing this with the DSL API. See: https://blog.jooq.org/2017/01/16/a-functional-programming-approach-to-dynamic-sql-with-jooq
The future of jOOQWhile the model API is still getting some new clauses support for SELECT
, INSERT
, UPDATE
, DELETE
statements, there are some statements that are not available in a model API form. These include MERGE
, TRUNCATE
, all DDL statements, all procedural statements. And, the WITH
clause.
The strategy is to eventually deprecate the model API, because the redundancy creates a lot of extra work that is better invested elsewhere. There are also subtle bugs when people call model API methods in unexpected order, i.e. an order that is not possible through the DSL API.
- In a first step, pretty soon, jOOQ will inverse the relationship between APIs: https://github.com/jOOQ/jOOQ/issues/11241. The model API will be the auxiliary wrapper of the DSL API for those who rely on it for backwards compatibility. It isn't unlikely that the model API will even be extracted into a separate compatibility module, to discourage its use in new code
- In a next step, with the dependencies inversed, the DSL API can finally become consistently immutable, which is what many users expect, and to their surprise, find lacking: https://github.com/jOOQ/jOOQ/issues/9047
- Eventually, the model API will be deprecated, and then dropped
You can still use it today, and the deprecation and removal will be done over a long period of time, so there's no hurry in getting off this API (as always with jOOQ). But in the context of your question, it's good to see that jOOQ will not invest in adding too many features to it, anymore. CTE support won't be added to the model API.
WorkaroundsYou can, of course, work around this limitation, because internally, the model API is CTE capable:
- You could use reflection to add new CTEs to the
SelectQuery
internal representation. I won't document how this works, here, because it's never a good idea to document these things :) - You could start creating a query using the DSL API, and then extract the internal
SelectQuery
representation usingSelectFinalStep.getQuery()
, and continue working from there.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install AddWith
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page