JOOQ create/drop temp tables?

827 views
Skip to first unread message

David Lee

unread,
Jul 10, 2013, 5:51:30 PM7/10/13
to jooq...@googlegroups.com
I converted most parts of my code to use jooq now however, there is a part I could not do without using a raw query.


create.query("CREATE TEMPORARY TABLE desctable( `stylenumber` varchar(20), `description` text, UNIQUE KEY `stylenumber` (`stylenumber`) )")
create.query("drop table desctable")


Any way to change this part to using normal jooq code?

Lukas Eder

unread,
Jul 11, 2013, 2:55:08 AM7/11/13
to jooq...@googlegroups.com
Hi David,


2013/7/10 David Lee <flyin...@gmail.com>
If by "normal" you mean using jOOQ's typesafe DSL API, then the above DDL statements are currently not supported. Support is on the long-term roadmap but hasn't been a priority so far:

Note, though that you could generate desctable artefacts from a regular table and make that generated code part of your codebase. You could then use generated artefacts to inline into your plain SQL statement:

create.query("CREATE TEMPORARY TABLE {0}({1} VARCHAR(20), {2} TEXT, UNIQUE KEY {1}({1})",
        DESCTABLE, DESCTABLE.STYLENUMBER, DESCTABLE.DESCRIPTION);
create.query("DROP TABLE {0}", DESCTABLE);

This might be useful if you have lots of temporary tables like that.

Cheers
Lukas
Reply all
Reply to author
Forward
0 new messages