Hi Mohan, Thanks for your message.
Indeed, jOOQ generates "\n" newline characters when you turn on formatting of your generated SQL. In the near future, we're planning on adding quite a few formatting options, which will also be very useful when used along with the new SQL parser added in jOOQ 3.9. I'll look into supporting overriding the newline character already in jOOQ 3.10: https://github.com/jOOQ/jOOQ/issues/6525 As far as "extra" parentheses are concerned, jOOQ is rather conservative here. Believe it or not, we've seen databases that do not get operator precedence right (e.g. between AND and OR). Other situations where parentheses are required is when you use a plain SQL Condition, and jOOQ cannot "guess" whether it needs to be wrapped in parentheses to maintain correctness, so they're always added. In the future, we might allow for overriding this kind of stylistic behaviour as well, e.g. by generating parentheses only when stricly needed to enforce precedence, but right now, this is not a priority. As a general rule of thumb, I wouldn't depend on the *exact* SQL string syntax generated by jOOQ. As long as the semantics is conserved, you should be fine for your tests. One option to test for semantic correctness is to use a SQL parser on jOOQ generated output, and compare the parsed expression tree with your expectations. Again, jOOQ 3.9 includes an experimental parser, which will be much improved in jOOQ 3.10, so perhaps you could use that. I hope this helps, Lukas 2017-08-25 0:02 GMT+02:00 Mohan <[email protected]>: > Hi, > > I am using JOOQ to generate the SQL. These SQL statements which are > getting generated are very complex. > > I need help/suggestions how to write JUnits to test against a SQL file. > > Issues I am running into are below > > - Line Seperator of CRLF vs LF. Seems JOOQ generates in a different > way. > - While using the conditon dsl it is adding extra () like *(designation > = 'MANAGER')* > > > > Regards, > Mohan > > -- > 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/d/optout. > -- 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/d/optout.
