Yes! it's what I need! thanks very much. I am just new for JOOQ and the document maybe a little confused for me
在 2017年2月24日星期五 UTC+8下午6:07:03,Lukas Eder写道: > > Hello, > > This is the expected behaviour of jOOQ. > > Your mistake is that you're using the plain SQL API to create what you > believe to be bind variables. > > DSL.field() is for plain SQL: > https://www.jooq.org/doc/latest/manual/sql-building/plain-sql > > DSL.val() is for bind variables: > https://www.jooq.org/doc/latest/manual/sql-building/bind-values > > DSL.inline() is for inline values (literals): > > https://www.jooq.org/doc/latest/manual/sql-building/bind-values/inlined-parameters > > So, the correct code would be: > > values.add(DSL.inline("003")); > values.add(DSL.inline("bob"));values.add(DSL.inline("24")); > > I hope this helps, > Lukas > > 2017-02-23 3:42 GMT+01:00 <[email protected] <javascript:>>: > >> HI ,I using JOOQ to build sql only, the code can see below: >> >> DSLContext create= DSL.using(SQLDialect.POSTGRES_9_5); >> List<Field<?>> columns=new ArrayList<>(); >> List<Field<?>> values=new ArrayList<>(); >> columns.add(DSL.field("id")); >> columns.add(DSL.field("name")); >> columns.add(DSL.field("age")); >> values.add(DSL.field("003")); >> values.add(DSL.field("bob")); >> values.add(DSL.field("24")); >> String >> sql=create.insertInto(DSL.table("task")).columns(columns).values(values).getSQL(); >> >> >> >> The sql is: insert into task (id, name, age) values (003, bob, 24) >> >> But it's wrong! it should be: insert into task (id, name, age) values >> ('003', 'bob', '24') >> >> >> Where the problem is? Many thanks for your answer~! >> >> -- >> 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] <javascript:>. >> 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.
