Commit Graph

8173 Commits

Author SHA1 Message Date
Lukas Eder
3ded80a981 [jOOQ/jOOQ#4454] Fixed DB2 regression 2020-01-24 10:35:12 +01:00
Knut Wannheden
da129e2bee [jOOQ/jOOQ#4793] Fix rendering of mapped catalog 2020-01-24 09:51:01 +01:00
Knut Wannheden
b5e76e076f [jOOQ/jOOQ#4793] Implement runtime catalog mapping
In addition to runtime schema and table mapping,
`Settings#renderMapping` now also supports mapping of catalogs. This is
represented by the new `RenderMapping#catalogs`, which in turn can
contain mapping definitions for schemata and tables.

For backwards compatibility and for applications where no catalog
mapping is required, the old `RenderMapping#schemata` remains. Users are
expected to use _either_ of 'RenderMapping#catalogs` or
`RenderMapping#schemata`, but not both.
2020-01-23 12:20:08 +01:00
Knut Wannheden
6ee58543fc [jOOQ/jOOQ#9200] Get rid of separate query to check for identity
Instead of running a separate query to check if the table has any
identity column this is now being done with a `COUNT(*) FILTER (WHERE
is_identity = 'YES') OVER ()` expression.
2020-01-23 09:53:12 +01:00
Knut Wannheden
8e613d14a9 [jOOQ/jOOQ#8953] Generate Internal#createQueue() call into Queues.java
The code generator will now generate a call to the new
`Internal#createQueue()` factory method instead of directly calling the
`QueueImpl` constructor.
2020-01-22 17:34:15 +01:00
Knut Wannheden
9e403efc7c [jOOQ/jOOQ#8953] No generic type parameter in generated createSequence()
In the generated `Sequences.java` files the generic type parameter in
the `Internal#createSequence()` calls can be omitted.
2020-01-22 17:25:29 +01:00
Knut Wannheden
c367663df7 [jOOQ/jOOQ#9200] Only use IS_IDENTITY if there are IDENTITY columns
The jOOQ code generator will now only map `COLUMNS.IS_IDENTITY` to
`ColumnDefinition#isIdentity()` if the table has a column for which
`COLUMNS.IS_IDENTITY` is `YES`. Otherwise it will continue to check if
the default value starts with `nextval`.
2020-01-22 16:02:36 +01:00
Knut Wannheden
450512c520 [jOOQ/jOOQ#8545] Fix rendering of CURRENT_TIME built-in
While `CURRENT_TIME` doesn't work in the CockroachDB release we
currently use in our integration testing, the necessary changes have
apparently already been integrated. This commit adjusts `CurrentTime`
accordingly so that it will work properly against releases which have
this built-in implemented.
2020-01-22 15:10:34 +01:00
Knut Wannheden
25772619df [jOOQ/jOOQ#3676] Try avoid rendering parenthesis for set operations
By default (`Settings#renderParenthesisAroundSetOperationQueries =
false`) jOOQ will attempt to avoid rendering parenthesis pairs around
the queries combined with set operators (e.g. `UNION` or `UNION ALL`).

In situations where this causes problems, i.e. when the parenthesis pair
is required, the setting can be set to `true` in which case the
parenthesis pair will always be rendered around each of the combined
queries.
2020-01-22 12:09:11 +01:00
Knut Wannheden
5064bd1d43 [jOOQ/jOOQ#9633] Fix case sensitivity for MariaDB 2020-01-22 11:15:07 +01:00
Knut Wannheden
91a5f9e3db [jOOQ/jOOQ#9200] Fix OSS edition incompatibility 2020-01-20 16:24:48 +01:00
Knut Wannheden
19a61d2214 [jOOQ/jOOQ#9200] Use COLUMNS.IS_IDENTITY for PostgreSQL 10+
As of PostgreSQL 10.0 the column
`INFORMATION_SCHEMA.COLUMNS.IS_IDENTITY` can be used to determine
whether a column represents a table's identity column or not. This is
now used by jOOQ's code generator and for older releases it will
continue to check wheter the default value (i.e. using
`INFORMATION_SCHEMA.COLUMNS.COLUMN_DEFAULT`) starts with `NEXTVAL`.
2020-01-20 15:54:09 +01:00
Lukas Eder
eab08e3a02 [jOOQ/jOOQ#9121] Make code Java 6 compatible 2020-01-20 12:09:31 +01:00
Lukas Eder
042c746b03 [jOOQ/jOOQ#9121] Generator does not report file in which invalid SQL was found 2020-01-20 11:41:04 +01:00
Knut Wannheden
7407843d1b [jOOQ/jOOQ#9747] Add Serializable as supertype to JSON and JSONB 2020-01-20 09:17:08 +01:00
Lukas Eder
6bdaee9d42 [jOOQ/jOOQ#5181] [jOOQ/jOOQ#6314] Add Meta.getIndexes() 2020-01-16 14:09:47 +01:00
Lukas Eder
ffd7b0cf87 [jOOQ/jOOQ#4454] Implement Table.getIdentity() for tables obtained via org.jooq.Meta 2020-01-16 13:43:34 +01:00
Lukas Eder
125b219920 [jOOQ/jOOQ#8323] Publish existing jOOQ-xtend project as a Maven module 2020-01-16 11:31:53 +01:00
Knut Wannheden
99e7a7bf6c [jOOQ/jOOQ#7421] Simplify REQUIRES_FROM_CLAUSE initializer 2020-01-16 09:57:45 +01:00
Lukas Eder
d5640d662b [jOOQ/jOOQ#9737] Wrong generics on DSLContext.selectFrom(Name) and similar methods 2020-01-15 17:30:40 +01:00
Knut Wannheden
2cf140263c [jOOQ/jOOQ#7421] Stop rendering FROM DUAL for MySQL 8+ and MariaDB 10.4+ 2020-01-15 17:19:40 +01:00
Lukas Eder
5305bb35c7 [jOOQ/jOOQ#8528] Rename class to TranslatingMetaProvider
The interpretation is not strictly about DDL, which is a historically
confusing term for all of this interpretation stuff.
2020-01-15 16:54:21 +01:00
Lukas Eder
9f1878372b [jOOQ/jOOQ#8528] Rename class to Interpreter
The interpretation is not strictly about DDL. DML statements can be interpreted as well
2020-01-15 16:52:39 +01:00
Lukas Eder
c2eb2e0dc7 [jOOQ/jOOQ#9734] Add <nonnullAnnotation/> and <nullableAnnotation/> 2020-01-15 16:13:42 +01:00
Lukas Eder
2323b2a3e1 [jOOQ/jOOQ#9733] Add <generatedNonnullAnnotationType/> and <generatedNullableAnnotationType/> 2020-01-15 14:26:27 +01:00
Lukas Eder
54e8a53628 [jOOQ/jOOQ#9732] Change default value of <generatedAnnotation/> to
"false"
2020-01-15 13:57:20 +01:00
Lukas Eder
45097fd05d [jOOQ/jOOQ#8677] Log warning when file based databases have invalid <jdbc/> configurations 2020-01-14 17:23:57 +01:00
Lukas Eder
7ab5709de4 [jOOQ/jOOQ#9726] FilePattern matches too many files when wildcards are
being used
2020-01-14 16:08:32 +01:00
Lukas Eder
439238bd98 [jOOQ/jOOQ#9726] FilePattern matches too many files when wildcards are
being used
2020-01-14 15:53:26 +01:00
Lukas Eder
4809fd4a55 [jOOQ/jOOQ#9726] FilePattern matches too many files when wildcards are being used 2020-01-14 15:47:49 +01:00
Lukas Eder
cff813a73e [jOOQ/jOOQ#9727] Add configuration/basedir to resolve relative paths in
code generator
2020-01-14 15:41:37 +01:00
Lukas Eder
8baac33263 [jOOQ/jOOQ#9726] FilePattern matches too many files when wildcards are
being used
2020-01-14 14:56:15 +01:00
Lukas Eder
025fc98685 [jOOQ/jOOQ#9725] Move org.jooq.meta.tools.FilePattern API to core library 2020-01-14 14:35:13 +01:00
Lukas Eder
1d22290407 [jOOQ/jOOQ#9684] Make Version and Migration APIs Internal for now 2020-01-14 10:41:04 +01:00
Knut Wannheden
6f6c623831 [jOOQ/jOOQ#7421] Render "dual" as string again
Im MySQL `DUAL` must not be rendered as quoted, therefore reverting last
commit to use `Names.N_DUAL` again.
2020-01-10 14:33:11 +01:00
Knut Wannheden
e13fd20658 [jOOQ/jOOQ#7421] Render "dual" as a name
The `DUAL` table will now be rendered as a `Name` rather than as the
plain string `dual`. This way it will also adhere to the name case
settings in the rendered SQL.
2020-01-10 14:04:42 +01:00
Knut Wannheden
11a5422efc [jOOQ/jOOQ#8755] Add Loader[CSV|JSON|Rows]Step#fieldsFromSource()
This new `fieldsFromSource()` method can be used when all or a subset of
the input field names exactly match the target table column names. The
load operation can then be executed without having to specify the fields
and will create rows with all matching fields (other fields are
ignored).

Since the fields are mapped by name this requires the input to specify
the field names. For CSV this means that there must be a header row,
otherwise using `fieldsFromSource()` will result in a runtime exception.
2020-01-10 10:12:25 +01:00
Knut Wannheden
93bfffea5c [jOOQ/jOOQ#9718] Fix return type of fields(LoaderFieldMapper) methods
The `LoaderCSVStep#fields(LoaderFieldMapper)` and
`LoaderJSONStep#fields(LoaderFieldMapper)` methods now have the correct
return type.
2020-01-09 14:55:07 +01:00
Knut Wannheden
2778b20375 [jOOQ/jOOQ#9719] Support MySQL's single argument ISNULL() in parser 2020-01-09 12:39:19 +01:00
Knut Wannheden
aa35783e55 [jOOQ/jOOQ#9598] Fix race condition caused by Tools#PARSER
Since this package private field `Tools#PARSER` isn't used anywhere, it
can just be deleted.
2020-01-09 08:22:08 +01:00
Knut Wannheden
922b62b444 Cleanup: Regenerate some more example code 2020-01-08 10:53:15 +01:00
Knut Wannheden
8c225c4501
Merge pull request #9700 from rweisleder/sakila-postgres-fix
Sakila/PostgreSQL: Don't fail if language plpgsql already exists
2020-01-08 10:49:57 +01:00
Knut Wannheden
33c517a1c8 [jOOQ/jOOQ#9708] Fix regex based schema mapping (with backreferences)
The way the schema mapping was implemented resulted in the schema
mapping always getting applied twice during the rendering. This was
problematic for regex based schema mappings using backreferences.

This commit changes the schema mapping logic so that
`SchemaMapping#map(Schema)` doesn't "recursively" map schemas. I.e. any
given schema is only mapped once.
2020-01-06 13:29:27 +01:00
Knut Wannheden
680cd20d08 [jOOQ/jOOQ#5714] Update examples where Date is now LocalDate
With [jOOQ/jOOQ#5714] the default value of `<javaTimeTypes>` changed
from `false` to `true`. This also requires a few changes in the example
code.
2020-01-06 10:14:18 +01:00
Knut Wannheden
7c08ea1e56 Cleanup: Regenerate jOOQ-spark-chart-example without @Generated 2020-01-06 09:56:55 +01:00
Knut Wannheden
588bf7036d Upgrade to JUnit 4.13
Removes jOOQ's own `assertThrows()` utility in favor of that in JUnit.
2020-01-06 09:35:34 +01:00
Roland Weisleder
63588967b9 Sakila/PostgreSQL: Don't fail if language plpgsql already exists
When using the Sakila DB with the Docker image postgres:12.1 the
initialisation fails with:
  ERROR:  language "plpgsql" already exists

With PostgreSQL 8.4 (see [1]) and earlier it was only possible to
execute:
  CREATE [ PROCEDURAL ] LANGUAGE name

Starting with PostgreSQL 9.0 (see [2]) it is possible to execute:
  CREATE [ OR REPLACE ] [ PROCEDURAL ] LANGUAGE name

This commit makes the SQL script incompatible with PostgreSQL 8.4
and earlier.

[1] https://www.postgresql.org/docs/8.4/sql-createlanguage.html
[2] https://www.postgresql.org/docs/9.0/sql-createlanguage.html
2019-12-26 13:15:17 +01:00
Lukas Eder
5ccc6cddb6 [jOOQ/jOOQ#9674] Bad SQL generated from implicit join from within subqueries 2019-12-23 12:36:16 +01:00
Lukas Eder
36981a1198 [jOOQ/jOOQ#9697] Full identifier qualification in generated code when <globalObjectReferences> is turned off 2019-12-23 10:53:55 +01:00
Knut Wannheden
0494314753 [jOOQ/jOOQ#9668] Offer Java 11 and Java 6 trial downloads
Add support for building `trial`, `trial-java-8`, and `trial-java-6`
editions analogously to the three pro editions.
2019-12-20 14:57:58 +01:00