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.