On Sun, 2012-05-20 at 17:22 +0200, Lukas Eder wrote:
> Hello Murray,
>
> Yes, that method is the best way to do what you intend. You can do
> something along these lines:
>
> create().select(field("length({1})", String.class, fieldByName("TITLE")))
> .from(tableByName("T_BOOK"))
> .fetch();
>
> I'll add this example to the Javadocs
Sorry, I linked to Factory.field() just to show what part of the
documentation contained that quote. But I'm trying to escape (and quote)
arbitrary SQL.
In this case, it's so I can supply the table names and field names to
CREATE DATBASE and CREATE TABLE SQL queries.
Murray
> 2012/5/19 Murray Cumming <[email protected]>:
> > Is there any general jOOQ method to escape (and maybe quote) SQL
> > identifiers such as table names and field names for use in raw SQL
> > queries?
> >
> > This documentation
> > http://www.jooq.org/javadoc/latest/org/jooq/impl/Factory.html#field%
> > 28java.lang.String,%20java.lang.Class,%20org.jooq.QueryPart...%29
> > rightly says "Be sure to properly ... escape literals ...", but it does
> > not recommend how best to do that.
> >
> > --
> > [email protected]
> > www.murrayc.com
> > www.openismus.com
> >
--
[email protected]
www.murrayc.com
www.openismus.com