Thanks for your message.

The logic to prevent quoting in SQLite is very old. I don't recall the
exact reason, but I believe that SQLite's parser had a lot of trouble with
quoted identifiers in some contexts - so the solution was to simply avoid
quoting, except for identifiers that conflict with keywords, or
that contain special characters. We could review changing this back again
if you can create a feature request?
https://github.com/jOOQ/jOOQ/issues/new/choose

Regarding your attempts to get "ANSI SQL," well, good luck :) This is the
first of hundreds of problems you'll run into. Why do you want to have
"standard SQL files"? How do you plan on executing them? Do note that
jOOQ's parser may offer the answer you're looking for:
https://www.jooq.org/doc/latest/manual/sql-building/sql-parser/

You can even use it as a JDBC driver to translate all string based SQL to
any dialect that jOOQ supports (if jOOQ can parse the SQL):
https://www.jooq.org/doc/latest/manual/sql-execution/parsing-connection/

On Thu, Mar 21, 2024 at 4:30 PM Marcel Overdijk <[email protected]>
wrote:

> Note I also tried with SQLDialect.POSTGRES and then I get the double
> quotes.
>
> But then date values are rendered like:
>
> INSERT INTO "TABLE_A" ("DATE") VALUES ( DATE '2024-03-21')
>
> which I think is not mandatory for PostgreSQL, but is not supported e.g.
> with SQLite...
>
>
>
>
> On Thursday, March 21, 2024 at 4:08:35 PM UTC+1 Marcel Overdijk wrote:
>
>>
>>
>>         // Create context.
>>
>>         Settings settings = new Settings()
>>                 .withRenderQuotedNames(RenderQuotedNames.ALWAYS);
>>
>>         DSLContext ctx = DSL.using(SQLDialect.SQLITE, settings);
>>
>>         // Insert statement.
>>
>>         Continent continent = new Continent();
>>         continent.setId("europe");
>>         continent.setCode("eu");
>>         continent.setName("Europe");
>>         continent.setDemonym("European");
>>
>>         String insert = ctx
>>                 .insertInto(CONTINENT)
>>                 .set(ContinentMapper.INSTANCE.unmap(continent))
>>                 .getSQL(ParamType.INLINED);
>>
>>         println(insert);
>>
>> but this generates:
>>
>> insert into continent (id, code, name, demonym) values ('europe', 'eu',
>> 'Europe', 'European')
>>
>> (without quoted identifiers)
>>
>>
>> Note: the schema was generated using DDLDatabase but I assume that should
>> not matter.
>>
>>
>> PS: for SQLite itself is does not matter that much that identifiers are
>> not quoted (although SQLite DOES support this)..
>> But in my scenario I'm trying to generate SQL files with inserts that are
>> database independent as possible.
>> I e.g. want to double quote the identifiers as I have fields with name
>> year which otherwise cause problems.
>> Although MySQL and MariaDB do not support double quotes without SET
>> sql_mode='ANSI_QUOTES'; I could make it work.
>> I'm basically looking for a ANSI dialect.
>>
>> Cheers,
>> Marcel
>>
>> --
> 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/f02416bb-2c93-44c8-8492-c036cb059ffcn%40googlegroups.com
> <https://groups.google.com/d/msgid/jooq-user/f02416bb-2c93-44c8-8492-c036cb059ffcn%40googlegroups.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/CAB4ELO4GQaVC2D9Vgs558AYWcQJUseOJBRf2_7Y8w56m1p3spA%40mail.gmail.com.

Reply via email to