1

Does jooq support running ad-hoc queries? I was wondering if it provides a data structure, similar with the C# DataTable (or the java CachedRowSet) where I can store the data from a query and which would support the different RDBMSes features such as Oracle cursor columns.

Thanks

boggy
  • 3,674
  • 3
  • 33
  • 56

1 Answers1

0

Does jooq support running ad-hoc queries?

Yes. Most of jOOQ is about running ad-hoc queries.

I was wondering if it provides a data structure, similar with the C# DataTable (or the java CachedRowSet) where I can store the data from a query and which would support the different RDBMSes features such as Oracle cursor columns comes to mind.

No, that's currently not supported but if I understand you correctly, it is on the roadmap:

Lukas Eder
  • 211,314
  • 129
  • 689
  • 1,509
  • Just to make sure, when I say support "ad-hoc" queries, I mean support running queries whose structure is available at runtime only. Tools such as sql studio, toad etc. they all support ad-hoc queries. They allow users to run any query. I didn't read the jooq documentation thoroughly but the samples I've seen assumed that you know the tables structures. – boggy Jun 19 '15 at 16:35
  • @costa: [Yes, those kinds of "ad-hoc" queries are supported too](http://www.jooq.org/doc/latest/manual/getting-started/use-cases/jooq-as-a-standalone-sql-builder), just like [plain SQL](http://www.jooq.org/doc/latest/manual/sql-building/plain-sql) – Lukas Eder Jun 19 '15 at 17:15
  • Could you please point me to a sample? I want see how you guys retrieve the data in this case and how the fields are accessed when you don't know the columns at the time of writing the code. I couldn't find a clear example in the documentation.Thank you – boggy Jun 19 '15 at 20:34
  • @costa: The [first link](http://www.jooq.org/doc/latest/manual/getting-started/use-cases/jooq-as-a-standalone-sql-builder) makes use of inlined strings, but you can have those strings as external sources as well. Also, there's a *["model API"](http://www.jooq.org/doc/latest/manual/sql-building/sql-statements/dsl-and-non-dsl/)* which allows you build more complex dynamic SQL... Not sure how I can further help here in the comments. Perhaps, you ask another specific question on Stack Overflow, explaining exactly the use-case you're looking for? – Lukas Eder Jun 20 '15 at 06:57