Commit Graph

4474 Commits

Author SHA1 Message Date
Knut Wannheden
070bb2cf99 [jOOQ/jOOQ#8820] Fix DSL#nextval() for POSTGRES
`DSL#nextval()` and `DSL#currval()` now also work properly if the
sequence has a name which needs to be escaped (e.g. "can't").
2019-06-20 16:06:22 +02:00
Knut Wannheden
59f3aea44d [jOOQ/jOOQ#8825] Added missing dialects to DatePart literals
The DB2 and SQLDATAWAREHOUSE dialects were missing on some of the
`DatePart` literals.
2019-06-20 15:41:26 +02:00
Knut Wannheden
b2d1119e24 [jOOQ/jOOQ#8754] Avoid using SQL templating
jOOQ should internally try to avoid using SQL templating. As a result
most implementation classes representing SQL built-in functions which
before inherited from `AbstractFunction` now directly extend
`AbstractField` instead and directly render the SQL rather than
returning a `Field` object to be rendered.
2019-06-20 12:26:45 +02:00
Lukas Eder
d954d5c246 [jOOQ/jOOQ#8620] Replace Query references by RowCountQuery where appropriate 2019-06-19 16:49:07 +02:00
Lukas Eder
e97a96396b [jOOQ/jOOQ#8746] Check for InvocationOrder.REVERSE instead of DEFAULT
The current implementation is checking if a given InvocationOrder setting is the DEFAULT. We should better check the inverse, if it is REVERSE and act accordingly. That way, both DEFAULT and null have the DEFAULT behaviour.
2019-06-19 15:49:38 +02:00
Lukas Eder
f79055b2cb [jOOQ/jOOQ#7518] Support parsing Teradata / Access MOD operator 2019-06-19 15:40:18 +02:00
Lukas Eder
d4a0e60bd8 [jOOQ/jOOQ#8817] Remove unnecessary {@inheritDoc} Javadoc tags in jOOQ's internals 2019-06-19 15:14:39 +02:00
Lukas Eder
d53dee0696 [jOOQ/jOOQ#8815] Add missing Javadoc to
Configuration.visitListenerProviders()
2019-06-19 11:09:48 +02:00
Lukas Eder
fadde3f096 [jOOQ/jOOQ#8810] Emulated ENUM types produce check constraint with bind variables 2019-06-18 13:48:10 +02:00
Knut Wannheden
8ceaf4ebf1 [jOOQ/jOOQ#8803] Improve performance of StringUtils#replace()
Replace `buf.append(text.substring(start, end))` with `buf.append(text,
start, end)` in `StringUtils#replace()`.
2019-06-18 07:48:24 +02:00
Lukas Eder
5b26bd463d [jOOQ/jOOQ#8806] Correctly parse identifiers that look like keywords
Parser doesn't correctly parse identifiers that can conflict with keywords. For example, when parsing TRIM(TRAILING.C) where TRAILING is a table reference, we parse it as a keyword and don't check if it is really just a qualified identifier. Whenever there's a . following a keyword, we'll treat the token as a non-keyword.
2019-06-17 13:00:20 +02:00
Lukas Eder
af742a3090 [jOOQ/jOOQ#8315] Optimize ScopeStack#get() (work by @knutwannheden) 2019-06-17 10:29:54 +02:00
Knut Wannheden
59f14e6f92 [jOOQ/jOOQ#8315] Optimize DefaultRenderContext#scopeRegister()
Not directly related to the `ScopeStack` implementation itself, but to
the main client of it.
2019-06-14 15:08:11 +02:00
Lukas Eder
384b5ec325 [jOOQ/jOOQ#8797] Improve StopWatchListener Javadoc
Add Javadoc to StopWatchListener explaining that it should be wrapped in an ExecuteListenerProvider
2019-06-13 17:37:44 +02:00
Lukas Eder
01dec5cadf [jOOQ/jOOQ#8795] Support SQLDATAWAREHOUSE for AlterTableAlterStep#set() 2019-06-13 16:55:34 +02:00
Knut Wannheden
f56955497f [jOOQ/jOOQ#8796] Support FIREBIRD_3_0 in InsertOnDuplicateSetStep
The `InsertOnDuplicateSetStep#set()` methods should declare FIREBIRD_3_0
support as with `InsertOnConflictDoUpdateStep#doUpdate()`. Support this
in `InsertQueryImpl` by emulating it using `MERGE`.
2019-06-13 16:00:55 +02:00
Knut Wannheden
cb176e2e08 [jOOQ/jOOQ#8794] Add dialects to OrderedAggregateFunction
Add MEMSQL and SQLSERVER2012 to OrderedAggregateFunction, as this API is
referenced by e.g. DSL#percentileCont() which states support for both of
these dialects.
2019-06-13 15:34:00 +02:00
Lukas Eder
2185f22ef0 [jOOQ/jOOQ#8789] Add support for parsing MySQL numeric interval literals 2019-06-13 15:26:34 +02:00
Knut Wannheden
fd6601c98c [jOOQ/jOOQ#8793] More dialects for MergeValuesStepN#values()
Add AURORA_POSTGRES, HANA, and POSTGRES.
2019-06-13 15:22:47 +02:00
Knut Wannheden
a9afab5822 [jOOQ/jOOQ#8780] Support SQLSERVER in AlterTableStep#renameIndex()
Add support for SQLSERVER2016 to `AlterTableStep#renameIndex()`.
2019-06-13 14:25:02 +02:00
Knut Wannheden
375ae0c70a [jOOQ/jOOQ#8780] Support SQLSERVER in AlterIndexStep
Add support for SQLSERVER2016 and SQLDATAWAREHOUSE to `AlterIndexStep`.
2019-06-13 14:10:11 +02:00
Knut Wannheden
222005c580 [jOOQ/jOOQ#8785] Remove TERADATA support from DSL#alterIndex()
No explicit ALTER INDEX ... RENAME support has been implemented for
TERADATA and no native ALTER INDEX command exists.
2019-06-13 14:01:29 +02:00
Knut Wannheden
70ef8a398c [#8784] Add AURORA_MYSQL and MARIADB support in MergeValuesStepN 2019-06-13 13:29:55 +02:00
Knut Wannheden
77e3390d6c [jOOQ/jOOQ#8783] Add VERTICA support in MergeNotMatchedSetStep 2019-06-13 13:22:13 +02:00
Knut Wannheden
299cd97d81 [jOOQ/jOOQ#8782] Add VERTICA to @Suport annotations on WindowRowsAndStep 2019-06-13 13:13:36 +02:00
Knut Wannheden
768b7c92d9 [jOOQ/jOOQ#8280] Add SQLITE support to WithAsStep<N> classes
SQLITE was missing in the @Support annotations of the methods on the
`WithAsStep<N>` classes.
2019-06-13 12:22:32 +02:00
Knut Wannheden
527486e296 [jOOQ/jOOQ#8777] Fix AbstractFormattable#formatCSV()
Two of the `AbstractFormattable#formatCSV()` overloads didn't respect
the `header` parameter.
2019-06-12 16:29:44 +02:00
Knut Wannheden
55cefa0f5a [jOOQ/jOOQ#8753] Add Context#sql(long), sql(float), and sql(double)
Adds the methods Context#sql(long), sql(float), and sql(double). These
are used by the default converters in DefaultBinding for better
performance.

Note that there is no sql(boolean), since "true" and "false" are
expected to be treated as keywords and as such respect the keyword
rendering style.
2019-06-12 12:33:51 +02:00
Knut Wannheden
6f936994af [jOOQ/jOOQ#8771] Add REDSHIFT support for SelectWithTiesAfterOffsetStep
The LIMIT WITH TIES clause can be emulated for REDSHIFT using RANK().
2019-06-12 11:26:23 +02:00
Knut Wannheden
74897133f2 [jOOQ/jOOQ#8744] H2: Support INSERT ... ON CONFLICT DO UPDATE
Support this clause by emulating it with MERGE.
2019-06-11 15:13:40 +02:00
Knut Wannheden
d6ff51aa43 [jOOQ/jOOQ#8774] Remove SQLITE from AlterTableAlterStep methods 2019-06-11 15:08:02 +02:00
Knut Wannheden
b798c038d0 [jOOQ/jOOQ#2059] Fix AlterTableRenameIndexToStep @Support annotations
This feature is not supported by MEMSQL.
2019-06-11 15:06:05 +02:00
Knut Wannheden
906ca2b0e4 [jOOQ/jOOQ#8772] Correct @Support annotations on CreateIndexIncludeStep 2019-06-11 14:46:44 +02:00
Knut Wannheden
afe0643d7c [jOOQ/jOOQ#8771] Remove REDSHIFT from SelectWithTiesAfterOffsetStep
SelectWithTiesAfterOffsetStep#withTies() is not supported by REDSHIFT.
2019-06-11 14:26:17 +02:00
Knut Wannheden
338c02a89e [jOOQ/jOOQ#8770] Fix @Support annotations of SelectLimitAfterOffsetStep
Align the @Support annotations of the limit() methods.
2019-06-11 14:16:27 +02:00
Knut Wannheden
046a99bb68 [jOOQ/jOOQ#8769] Fix @Support annotations on TableOuterJoinStep
TableOuterJoinStep is for the time being only supported by ORACLE.
2019-06-11 14:08:06 +02:00
Knut Wannheden
88be3c65ab [jOOQ/jOOQ#8767] Add DB2 and FIREBIRD support to DSL#alterView()
DSL#alterView() was missing `DB2` and `FIREBIRD` in its `@Support`
annnotation.
2019-06-11 13:41:39 +02:00
Knut Wannheden
9e1a69ab54 [jOOQ/jOOQ#8766] Add missing dialects to @Support of mergeInto()
Adds AURORA_POSTGRES, HANA, and POSTGRES_9_5 to @Support annotation of
DSLContext#mergeInto(Table) and DSL#mergeInto(Table).
2019-06-11 11:58:23 +02:00
Lukas Eder
fa17504b57 [jOOQ/jOOQ#8723] Fixed this issue for Teradata 2019-06-07 16:01:59 +02:00
Lukas Eder
4c77d1386e [jOOQ/jOOQ#8761] Fix missing Support annotations for Teradata 2019-06-07 15:50:44 +02:00
Knut Wannheden
9cd09f5b70 [jOOQ/jOOQ#8758] [jOOQ/jOOQ#7518] DEFAULT in INSERT and MERGE
The DEFAULT keyword is now also properly supported in the INSERT and
MERGE statements.
2019-06-07 15:49:56 +02:00
Lukas Eder
82e4a12712 [jOOQ/jOOQ#8759] Add support for SET SCHEMA in Teradata 2019-06-07 15:24:55 +02:00
Knut Wannheden
bb871723a7 [jOOQ/jOOQ#8760] [jOOQ/jOOQ#7518] Parse TIMESTAMPDIFF()
The parser now supports parsing the TIMESTAMPDIFF() function, which is
mapped to DSL#timestampDiff().
2019-06-07 15:23:47 +02:00
Knut Wannheden
a1c54350a5 [jOOQ/jOOQ#8758] Parse UPDATE keyword in UPDATE statements 2019-06-07 14:54:38 +02:00
Knut Wannheden
ae13be078d [jOOQ/jOOQ#8736] Avoid NumberFormatException in Convert
This commit makes `NumberFormatException`s less likely to happen in
`Convert.ConvertAll#from(Object)` by first attempting to parse the
string representation of the value using `Ints#tryParse()` or
`Longs#tryParse()` (as appropriate). If that fails the conversion will
still try to use `BigDecimal(String)`, as that also allows parsing
numbers with fractions and / or exponent.

Note that this change required moving `tryParseInt()` and
`tryParseLong()` from `Tools` to the new public classes `Ints` and
`Longs` which have the license header from the corresponding
Guava sources, where the methods were copied from.
2019-06-07 14:52:39 +02:00
Lukas Eder
dce1a6a2b9 [jOOQ/jOOQ#8756] DSL.timestampAdd() produces wrong cast for teradata 2019-06-07 14:28:23 +02:00
Lukas Eder
6e7eda9a36 [jOOQ/jOOQ#8728] Parser cannot handle double quoted string literals in dialects that support them 2019-06-07 11:50:16 +02:00
Knut Wannheden
351b45b1ae [jOOQ/jOOQ#8751] Slightly improve performance of Integer rendering
When rendering Integer values (e.g. represented by Val objects) the
`DefaultIntegerBinding` can be optimized to use `RenderContext#sql(int)`
rather than `RenderContext#sql(String)`, as the latter requires to first
call `Integer#toString()`.
2019-06-07 07:49:44 +02:00
Knut Wannheden
c43f685199 [jOOQ/jOOQ#8751] Optimize placeholder logic in Tools#renderAndBind()
Add new private Tools#tryParseInt(String, int, int) method so that
Tools#renderAndBind() doesn't first have to call String#substring(int,
int).
2019-06-06 15:54:43 +02:00
Knut Wannheden
ddff21fc07 [jOOQ/jOOQ#8751] Improve SQL rendering performance
Improves the rendering of SQL relying on the keyword placeholders in
string templates as in e.g. "{substring}({0} {from} {1} {for} {2})",
where {substring} and {from} denote keywords.

The rendering is improved by changing `KeywordImpl` to lazily render the
keywords in the UPPER, LOWER, and PASCAL styles.
2019-06-06 15:37:09 +02:00
Lukas Eder
cceea5f1d8 [jOOQ/jOOQ#8746] Add support for reversing the listener invocation order
In some cases, it may make sense to support reversing the invocation
order for some listener lists, e.g. for VisitListener (in this
commit), depending on whether we're calling a [action]Start() or an
[action]End() event.
2019-06-06 14:38:38 +02:00
Lukas Eder
277b295cd0 [jOOQ/jOOQ#8746] Add support for reversing the listener invocation order
In some cases, it may make sense to support reversing the invocation
order for some listener lists, e.g. for TransactionListener (in this
commit), depending on whether we're calling a [action]Start() or an
[action]End() event.
2019-06-06 14:18:22 +02:00
Lukas Eder
0fba3e7564 [jOOQ/jOOQ#8746] More reusable code 2019-06-06 14:04:06 +02:00
Lukas Eder
7fda1e6d0d [jOOQ/jOOQ#8746] Add support for reversing the listener invocation order
In some cases, it may make sense to support reversing the invocation
order for some listener lists, e.g. for RecordListener (in this
commit), depending on whether we're calling a [action]Start() or an
[action]End() event.
2019-06-06 14:01:53 +02:00
Lukas Eder
463a621787 [jOOQ/jOOQ#8746] Add support for reversing the listener invocation order
In some cases, it may make sense to support reversing the invocation order for some listener lists, e.g. for ExecuteListener (in this commit), depending on whether we're calling a [action]Start() or an [action]End() event.
2019-06-06 12:14:53 +02:00
Knut Wannheden
2d118d83d6 [jOOQ/jOOQ#8654] Support ALTER TABLE ... DROP PRIMARY KEY for H2
H2 also has native support for this clause.
2019-06-06 11:32:22 +02:00
Knut Wannheden
3726b347b4 [jOOQ/jOOQ#8744] H2: Support INSERT ... ON CONFLICT DO UPDATE
Support this clause by emulating it with MERGE.
2019-06-06 10:16:21 +02:00
Knut Wannheden
6dfd51a8ca [jOOQ/jOOQ#8732] H2: Fix DSL#week() implementation
For H2 the DSL#week() function should be mapped to the ISO_WEEK()
function as EXTRACT(WEEK FROM ...) is equivalent to the WEEK() function.
2019-06-06 10:15:14 +02:00
Knut Wannheden
81fc8c62ae [jOOQ/jOOQ#8742] H2: Support DROP SCHEMA ... [CASCADE | RESTRICT] 2019-06-06 10:14:11 +02:00
Knut Wannheden
b1bebfbb0e [jOOQ/jOOQ#8739] Support ALTER SCHEMA in H2 2019-06-05 16:16:34 +02:00
Knut Wannheden
2765329af3 [jOOQ/jOOQ#8736] Add Tools#tryParseInt() and Tools#tryParseLong()
For the benefit of performance Tools#renderAndBind() now no longer uses
Integer#parseInt() when deciding whether a placeholder is a keyword or
an index of a bind value.

Also AbstractQuery#bind(String, Object) and DefaultBinding#parse(Class,
String) no longer rely on Integer#parseInt() or Long#parseLong().

The new methods in Tools are based on the Guava method
Longs#tryParse(String, int).
2019-06-05 12:39:08 +02:00
Knut Wannheden
56ee881246 [jOOQ/jOOQ#8737] Fix date arithmetic does not support fractional seconds
Date arithmetic now uses strftime(), so that fractional seconds don't
get trimmed.
2019-06-05 09:47:07 +02:00
Knut Wannheden
37727bee41 [jOOQ/jOOQ#8735] Support Offset[Date]Time and Instant for SQLite
For SQLite the Java 8 time types Offset[Date|DateTime|Time] and Instant
are now supported. SQLite basically supports date and time data with
time zones as input. Returned values are however always in Zulu / UTC
time, as with some other dialects.
2019-06-05 08:44:08 +02:00
Knut Wannheden
a67fbe5b79 [jOOQ/jOOQ#8730] Fix binding of Java 8 date and time literals
In SQLite the binding of [Local|Offset][Date][Time] literals didn't
always work correctly when the value specified fractional seconds. This
was because the corresponding DSL method would return a DateOrTime
instance rather than a simple Tools#field() constructed instance. This
commit fixes that.
2019-06-05 08:41:55 +02:00
Lukas Eder
11c5e08fc5 [jOOQ/jOOQ#7389] UniqueKey.getReferences returns unnamed foreign keys 2019-06-04 16:50:32 +02:00
Lukas Eder
d538acfac6 [jOOQ/jOOQ#8723] Fixed parser test 2019-06-03 11:03:48 +02:00
Lukas Eder
9f363f75d4 Whitespace change 2019-06-03 10:13:29 +02:00
Lukas Eder
1599efa5f9 [jOOQ/jOOQ#8727] Bad Support annotation on Row[N].op(QuantifiedSelect) 2019-06-03 10:13:07 +02:00
Lukas Eder
6c5bc13cc1 [jOOQ/jOOQ#7120] SQL Server fix 2019-05-31 15:15:44 +02:00
Lukas Eder
712b4afad7 [jOOQ/jOOQ#8723] Fixed this issue for PostgreSQL 2019-05-31 14:42:31 +02:00
Lukas Eder
f33b1f1512 [jOOQ/jOOQ#8723] Fixed this issue for MariaDB / MySQL 2019-05-31 14:37:12 +02:00
Lukas Eder
72964e352c [jOOQ/jOOQ#8041] Add support for DataType.characterSet() 2019-05-31 14:17:06 +02:00
Lukas Eder
290a1bf487 [jOOQ/jOOQ#8724] Add UpdateSetStep.setNull(Field<?>) for convenience 2019-05-31 13:37:47 +02:00
Lukas Eder
bfd68f5947 [jOOQ/jOOQ#8723] Wrong SQL generated when using qualified index references with H2 CREATE or DROP INDEX statements 2019-05-31 13:05:10 +02:00
Lukas Eder
5b281e2795 Merge branch 'master' of https://github.com/jOOQ/jOOQ 2019-05-29 16:15:40 +02:00
Lukas Eder
999a4eb761 [jOOQ/jOOQ#8717] Support parsing SQL Server's UNIQUEIDENTIFIER data type 2019-05-29 16:15:15 +02:00
Knut Wannheden
dd9b685055 [jOOQ/jOOQ#8716] Support DSL#md5() for SQL Server and SQL Data Warehouse 2019-05-29 15:41:19 +02:00
Knut Wannheden
8ca6c01264 Simplify @Support annotation on createTable()
The @Support annotations on DSL#createTable() and
DSLContext#createTable() don't need to explicitly list all families.
2019-05-29 08:04:06 +02:00
Lukas Eder
3bb2fef32d [jOOQ/jOOQ#6920] Update API with Vertica Support annotations 2019-05-28 17:56:36 +02:00
Knut Wannheden
8b4e41dacf [#8682] Correctly parse SQL Server LOG() function 2019-05-28 17:00:52 +02:00
Knut Wannheden
635cbc1874 [#8682] Correctly parse SQL Server LOG() function
SQL Server's LOG() function defines the parameters in reverse order from
the SQL standard (see
https://docs.microsoft.com/sql/t-sql/functions/log-transact-sql?view=sql-server-2017).
Also, instead of a dedicated LN() function the natural logarithm is
calculated by omitting the second parameter (representing the base). The
same applies to SQL Data Warehouse.

Again reverting change in DSL#log(Number, int) to use Tools#field() over
DSL#val().
2019-05-28 16:53:53 +02:00
Lukas Eder
2327516eaa [jOOQ/jOOQ#8709] Work around Vertica's incorrect IS NOT NULL implementation 2019-05-28 16:26:03 +02:00
Knut Wannheden
988e868444 [#8703] Use DSL#val(Object) over Tools#field(Object)
In DSL#log(Number, int) the input is known to be a Number so it makes
more sense to call DSL#val(Object) directly.
2019-05-28 16:20:33 +02:00
Lukas Eder
9459e9fc49 [jOOQ/jOOQ#8708] Ranking functions without ORDER BY are not correctly emulated in Vertica 2019-05-28 16:10:28 +02:00
Lukas Eder
a083eb10d1 [jOOQ/jOOQ#8706] Error when translating a query with OFFSET only (no LIMIT) to Vertica 2019-05-28 16:02:48 +02:00
Knut Wannheden
4e88bb2727 [#8707] Fix switch in FunctionTable#accept() 2019-05-28 15:59:06 +02:00
Knut Wannheden
d751d6edc7 [#8547] Fix SQLITE comparisons against dialect
SQLITE should normally be compared against the dialect family.

Also replace some occurrences of `context.configuration().dialect()`
with `context.dialect()`.
2019-05-28 15:51:08 +02:00
Knut Wannheden
2b26053a64 [jOOQ/jOOQ#6920] Update API with Vertica Support annotations 2019-05-28 15:32:00 +02:00
Knut Wannheden
de263dc9b8 [#8547] Add missing SQLITE_3_x cases to switches
Add missing cases for SQLITE_3_25 and SQLITE_3_28 in dialect switches.
2019-05-28 15:17:10 +02:00
Knut Wannheden
2e6a9514c3 [#8703] Add DSL#log(Field, Field)
Adds an overload DSL#log(Field, Field) which is also used by the parser,
as the base can for multiple dialects both be a float literal or an
arbitrary expression.
2019-05-28 15:05:01 +02:00
Lukas Eder
89a1751918 [jOOQ/jOOQ#6920] Update API with Vertica Support annotations 2019-05-28 14:55:29 +02:00
Lukas Eder
1a849a9232 [jOOQ/jOOQ#6920] Update API with Vertica Support annotations 2019-05-28 14:55:05 +02:00
Lukas Eder
130db06e3c [jOOQ/jOOQ#8704] Add support for MERGE in Vertica 2019-05-28 14:53:58 +02:00
Knut Wannheden
1cd7aa47fb [#8696] Added "fall through" comments to make code better readable 2019-05-28 12:59:38 +02:00
Knut Wannheden
a986cd0380 [#8696] Use SQL Server 2012's LOG() function with base parameter
SQL Server 2012's LOG() function accepts an optional second parameter to
specify the "base" to use. Use this rather than emulate that function.
2019-05-28 12:39:21 +02:00
Knut Wannheden
0b8f7cc111 [#8699] In Trim add case for SQLITE_3_25 and SQLITE_3_28
The switch over Configuration#dialect() was missing cases for
SQLITE_3_25 and SQLITE_3_28.
2019-05-28 12:17:21 +02:00
Knut Wannheden
2ef879d6bc [#8699] In Trim add case for SQLITE_3_25 and SQLITE_3_28
The switch over Configuration#dialect() was missing cases for
SQLITE_3_25 and SQLITE_3_28.
2019-05-28 12:15:34 +02:00
Knut Wannheden
893ce190e3 [#8698] In Sign switch over Configuration#family()
The switch over Sign#dialect() was wrong (typo).
2019-05-28 12:09:09 +02:00
Knut Wannheden
9a7e111fb9 [#8697] Removed MYSQL case from switch in MD5
Since the case was the default ayway it (along with some others) could
be removed.
2019-05-28 12:02:34 +02:00
Knut Wannheden
ed0634f0cb [#8695] Use Configuration#family() convenience method
Replace expressions like `configuration.dialect().family()` with
`configuration.family()`.
2019-05-28 11:41:04 +02:00