Hey Lukas, Thanks for the links. I was not aware of the one from your blog. I'm pretty sure that I understand what is going on now. I have finished a draft of a short tutorial for my students. You can see it here <https://git.uark.edu/rossetti/jooqexampleproject>. If you ever have time to look it over, I would appreciate any feedback, especially if I got something wrong about jooq.
On Tue, Aug 3, 2021 at 1:10 PM Lukas Eder <[email protected]> wrote: > Hi Manuel. > > "What's in a name" -- William Shakespeare > > Maybe, this helps explain what you've observed? > > - https://blog.jooq.org/2020/04/03/whats-a-string-in-the-jooq-api/ > - https://www.jooq.org/doc/latest/manual/sql-building/names/ > - > https://www.jooq.org/doc/latest/manual/sql-building/dsl-context/custom-settings/settings-name-style/ > > You can call DSL.unquotedName() to make names explicitly unquoted. > > If they are supposed to be different by design, which SQL building >> approach is more recommended? > > > It is always recommended to create explicit identifiers using DSL.name(), > DSL.quotedName(), DSL.unquotedName() instead. > > Thanks, > Lukas > > On Fri, Jul 30, 2021 at 9:53 PM Manuel Rossetti <[email protected]> > wrote: > >> Hello, >> I am using JOOQ to make a tutorial for my students. I see the following >> rendering behavior: >> import static org.jooq.impl.DSL.*; // this import allows for the fluent >> use of the DSL class >> import static org.jooq.impl.SQLDataType.*; // this import is so that you >> don't have to type SQLDataType.INTEGER etc >> >> // this statement builds a step in a SQL build process that defines a >> table creation >> CreateTableConstraintStep step = createTable("Supplier") >> .column("SNUM", INTEGER) >> .column("SNAME", VARCHAR(16).nullable(false)) >> .column("STATUS", INTEGER.nullable(false)) >> .column("CITY", VARCHAR(20).nullable(false)) >> .constraints( >> primaryKey("SNUM"), >> unique("SNAME")); >> // the statement can be printed, etc. But, more usefully it can be >> executed within a context. >> System.out.println(step.toString()); >> String sql = step.getSQL(); >> System.out.println(sql); >> System.out.println(); >> >> CreateTableConstraintStep step1 = createTable(table("Supplier")) >> .column(field("SNUM", INTEGER)) >> .column(field("SNAME", VARCHAR(16).nullable(false))) >> .column(field("STATUS", INTEGER.nullable(false))) >> .column(field("CITY", VARCHAR(20).nullable(false))) >> .constraints(primaryKey(field("SNUM")), >> unique(field("SNAME"))); >> >> System.out.println(step1.toString()); >> String sql1 = step1.getSQL(); >> System.out.println(sql1); >> System.out.println(); >> >> *These produce this output:* >> >> create table "Supplier" ( >> "SNUM" integer null, >> "SNAME" varchar(16) not null, >> "STATUS" integer not null, >> "CITY" varchar(20) not null, >> primary key ("SNUM"), >> unique ("SNAME") >> ) >> create table "Supplier" ("SNUM" integer null, "SNAME" varchar(16) not >> null, "STATUS" integer not null, "CITY" varchar(20) not null, primary key >> ("SNUM"), unique ("SNAME")) >> >> create table Supplier ( >> SNUM integer null, >> SNAME varchar(16) not null, >> STATUS integer not null, >> CITY varchar(20) not null, >> primary key (SNUM), >> unique (SNAME) >> ) >> create table Supplier (SNUM integer null, SNAME varchar(16) not null, >> STATUS integer not null, CITY varchar(20) not null, primary key (SNUM), >> unique (SNAME)) >> >> So, I am wondering why the the resulting strings are rendered with and >> without quotes. >> >> Unless I am missing something, I thought that they should be rendered the >> same. If they are supposed to be different by design, which SQL building >> approach is more recommended? >> >> -- >> 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]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/jooq-user/7ec4d569-f25c-465f-81c5-483d82a73025n%40googlegroups.com >> <https://groups.google.com/d/msgid/jooq-user/7ec4d569-f25c-465f-81c5-483d82a73025n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to a topic in the > Google Groups "jOOQ User Group" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/jooq-user/Q6vmm9k0EAs/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jooq-user/CAB4ELO42jKMj4Ak2V_g06%3DM8oFYcn4nL2T6Fa2gBpMOvedka0g%40mail.gmail.com > <https://groups.google.com/d/msgid/jooq-user/CAB4ELO42jKMj4Ak2V_g06%3DM8oFYcn4nL2T6Fa2gBpMOvedka0g%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- 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]. To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/CAMbxvHmmY%3DFPPQyuMUqrisOqoFow97UQymz-ieszUShn4N-3cA%40mail.gmail.com.
