> Let's see how this goes. A first attempt of implementing
> this failed as I have a choice between:
 > 
> - Letting the API explode completely (including sql()
> methods before/after AND, OR, IN, NOT, CASE, WHEN, THEN,
> etc. etc.
> - Offering only few sql() methods e.g. before or after
> the SELECT statement keywords, in case of which the
> usefulness of this feature is dubious...

Can't sql() be added to the superclass of all these SQL-generating classes? 
You'd need to play some tricks with generics to make that type-safe, but the 
technique for that is well-established nowadays (I've been playing with this 
enough to use it routinely, so I'm ready to answer questions on that).
Its semantics would be to append the given string to the generated SQL. No 
guarantees about syntactical validity.

Plays havoc with any formatting that the SQL generators might attempt.
Also, runs into some trouble whenever SQL generation looks at multiple AST 
nodes. (Does it?)

> jOOQ already supports a .hint() method, mainly
> aimed at Oracle users who want to inject query hints:
> 
> select(a, b).hint("/*+ALL_ROWS*/").from(t)
> 
> You can use this for other purposes than hints of course.

Ah yes, right, thanks for the reminder.

>> Also, I'm generating views. These are used by third
>> parties, and I've been making a point of documenting
>> them to people can see what the view does.
>> It would be cool if I could do that via Jooq-generated
>> views, too.
> 
> What do you consider a "jOOQ-generated view"?

I'm currently generating some overly complicated but regular views from Java. 
That keeps the Java and Oracle side of things in sync, the software simply has 
a maintenance mode where it generates the view definitions, ready to be pasted 
into an SQL command line.
Doing the SQL generation from Jooq would probably simplify the code.

> As with any type of plain SQL, you're on your own.
> You'll risk to run into syntax errors and SQL injection.

Heh. Fortunately, that type of SQL generation does not process external input, 
just hardcoded definitions.

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to