[#2606] Distinguish ORACLE10G, ORACLE11G, ORACLE12C SQLDialects within
the ORACLE family
This commit is contained in:
parent
e811cfd66d
commit
604a73b7b8
@ -130,7 +130,7 @@ public class DefaultDataTypeDefinition implements DataTypeDefinition {
|
||||
|
||||
@Override
|
||||
public final boolean isGenericNumberType() {
|
||||
switch (getDialect()) {
|
||||
switch (getDialect().family()) {
|
||||
case ORACLE: {
|
||||
return (OracleDataType.NUMBER.getTypeName().equalsIgnoreCase(typeName)
|
||||
&& precision == 0
|
||||
|
||||
20
jOOQ-test/launch/OracleTest (11g).launch
Normal file
20
jOOQ-test/launch/OracleTest (11g).launch
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/jOOQ-test/src/org/jooq/test/OracleTest11g.java"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="1"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
|
||||
<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
|
||||
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
|
||||
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.jooq.test.OracleTest11g"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="jOOQ-test"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dorg.jooq.configuration=/org/jooq/configuration/${env_var:USERNAME}/oracle/library.xml"/>
|
||||
</launchConfiguration>
|
||||
54
jOOQ-test/src/org/jooq/test/OracleTest11g.java
Normal file
54
jOOQ-test/src/org/jooq/test/OracleTest11g.java
Normal file
@ -0,0 +1,54 @@
|
||||
/**
|
||||
* Copyright (c) 2009-2013, Lukas Eder, lukas.eder@gmail.com
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed to you under the Apache License, Version 2.0
|
||||
* (the "License"); You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* . Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* . Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* . Neither the name "jOOQ" nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package org.jooq.test;
|
||||
|
||||
import org.jooq.DSLContext;
|
||||
import org.jooq.SQLDialect;
|
||||
import org.jooq.conf.Settings;
|
||||
import org.jooq.impl.DSL;
|
||||
|
||||
|
||||
/**
|
||||
* @author Lukas Eder
|
||||
*/
|
||||
public class OracleTest11g extends OracleTest {
|
||||
|
||||
@Override
|
||||
protected DSLContext create0(Settings settings) {
|
||||
return DSL.using(getConnection(), SQLDialect.ORACLE11G, settings);
|
||||
}
|
||||
}
|
||||
@ -182,7 +182,7 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
|
||||
assertEquals(1, record.store());
|
||||
record.refresh();
|
||||
|
||||
switch (dialect()) {
|
||||
switch (dialect().family()) {
|
||||
|
||||
// In ASE, there don't seem to be any empty byte[]
|
||||
case ASE:
|
||||
@ -218,7 +218,7 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
|
||||
record.setValue(T725_ID(), 3);
|
||||
record.refresh();
|
||||
|
||||
switch (dialect()) {
|
||||
switch (dialect().family()) {
|
||||
case ASE:
|
||||
assertEquals(1, record.getValue(T725_LOB()).length);
|
||||
assertEquals(0, record.getValue(T725_LOB())[0]);
|
||||
@ -246,7 +246,7 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
|
||||
assertEquals(BOOK_IDS, result.getValues(0));
|
||||
assertNull(result.getValue(1, 1));
|
||||
|
||||
switch (dialect()) {
|
||||
switch (dialect().family()) {
|
||||
case ASE:
|
||||
assertEquals(1, result.getValue(2, T725_LOB()).length);
|
||||
assertEquals(0, result.getValue(2, T725_LOB())[0]);
|
||||
@ -461,7 +461,7 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
|
||||
SQLDataType.VARBINARY,
|
||||
SQLDataType.VARCHAR)) {
|
||||
|
||||
if (dialect() == SQLDialect.ORACLE) {
|
||||
if (dialect().family() == SQLDialect.ORACLE) {
|
||||
if (type.getType() == byte[].class ||
|
||||
type == SQLDataType.CLOB ||
|
||||
type == SQLDataType.NCLOB) {
|
||||
@ -471,10 +471,10 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
|
||||
}
|
||||
}
|
||||
|
||||
if (dialect() == SQLDialect.ASE ||
|
||||
dialect() == SQLDialect.DB2 ||
|
||||
dialect() == SQLDialect.ORACLE ||
|
||||
dialect() == SQLDialect.SYBASE) {
|
||||
if (dialect().family() == SQLDialect.ASE ||
|
||||
dialect().family() == SQLDialect.DB2 ||
|
||||
dialect().family() == SQLDialect.ORACLE ||
|
||||
dialect().family() == SQLDialect.SYBASE) {
|
||||
if (type.getType() == Boolean.class) {
|
||||
log.info("SKIPPING", "Casting to bit type in Sybase ASE / SQL Anywhere");
|
||||
continue;
|
||||
|
||||
@ -108,7 +108,7 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
|
||||
|
||||
@Test
|
||||
public void testTableWithHint() throws Exception {
|
||||
switch (dialect()) {
|
||||
switch (dialect().family()) {
|
||||
case ASE:
|
||||
case CUBRID:
|
||||
case DB2:
|
||||
|
||||
@ -413,7 +413,7 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
|
||||
|
||||
@Test
|
||||
public void testFetchMany() throws Exception {
|
||||
switch (dialect()) {
|
||||
switch (dialect().family()) {
|
||||
case ORACLE:
|
||||
case SQLITE:
|
||||
case SYBASE:
|
||||
@ -2148,7 +2148,7 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
|
||||
assertEquals(r3.get(0).getValue(TBook_TITLE()), r3.get(1).getValue(TBook_TITLE()));
|
||||
|
||||
// Some JDBC drivers already perform string interning...
|
||||
if (dialect() == ORACLE) {
|
||||
if (dialect().family() == ORACLE) {
|
||||
Assert.assertNotSame(r1.get(0).getValue(TBook_TITLE()), r1.get(1).getValue(TBook_TITLE()));
|
||||
}
|
||||
|
||||
|
||||
@ -366,7 +366,7 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
|
||||
jOOQAbstractTest.reset = false;
|
||||
|
||||
Field<?> nullField = null;
|
||||
switch (dialect()) {
|
||||
switch (dialect().family()) {
|
||||
case ORACLE:
|
||||
case POSTGRES:
|
||||
// TODO: cast this to the UDT type
|
||||
|
||||
@ -306,7 +306,7 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
|
||||
create().select(TAuthor_LAST_NAME(), TBook_TITLE())
|
||||
.from(TBook())
|
||||
.naturalJoin(TAuthor())
|
||||
.orderBy(dialect() == SQLDialect.ORACLE
|
||||
.orderBy(dialect().family() == SQLDialect.ORACLE
|
||||
? field("id")
|
||||
: TBook_ID())
|
||||
.fetch();
|
||||
@ -324,7 +324,7 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
|
||||
create().select(TAuthor_LAST_NAME(), TBook_TITLE())
|
||||
.from(TBook())
|
||||
.naturalLeftOuterJoin(TAuthor())
|
||||
.orderBy(dialect() == SQLDialect.ORACLE
|
||||
.orderBy(dialect().family() == SQLDialect.ORACLE
|
||||
? field("id")
|
||||
: TBook_ID())
|
||||
.fetch();
|
||||
@ -348,7 +348,7 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
|
||||
.from(TAuthor())
|
||||
.join(TBook())
|
||||
.using(TAuthor_ID())
|
||||
.orderBy(dialect() == SQLDialect.ORACLE
|
||||
.orderBy(dialect().family() == SQLDialect.ORACLE
|
||||
? field("id")
|
||||
: TBook_ID())
|
||||
.fetch();
|
||||
@ -367,7 +367,7 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
|
||||
.from(TBook())
|
||||
.leftOuterJoin(TAuthor())
|
||||
.using(TAuthor_ID())
|
||||
.orderBy(dialect() == SQLDialect.ORACLE
|
||||
.orderBy(dialect().family() == SQLDialect.ORACLE
|
||||
? field("id")
|
||||
: TBook_ID())
|
||||
.fetch();
|
||||
|
||||
@ -220,7 +220,7 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
|
||||
.from(TAuthor())
|
||||
.where(TAuthor_ID().in(3, 4))
|
||||
.and(TAuthor_LAST_NAME().in("Hesse", "Frisch"))
|
||||
.and(dialect() == ORACLE ?
|
||||
.and(dialect().family() == ORACLE ?
|
||||
TAuthor_FIRST_NAME().isNull() :
|
||||
TAuthor_FIRST_NAME().equal(""))
|
||||
.fetchOne(count));
|
||||
@ -257,7 +257,7 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
|
||||
assertEquals("Hesse", result.getValue(0, TAuthor_LAST_NAME()));
|
||||
assertEquals("Frisch", result.getValue(1, TAuthor_LAST_NAME()));
|
||||
assertEquals(null, result.getValue(0, TAuthor_FIRST_NAME()));
|
||||
assertEquals(dialect() == ORACLE ? null : "", result.getValue(1, TAuthor_FIRST_NAME()));
|
||||
assertEquals(dialect().family() == ORACLE ? null : "", result.getValue(1, TAuthor_FIRST_NAME()));
|
||||
|
||||
assertEquals(2, create().delete(TAuthor()).where(TAuthor_ID().in(5, 6)).execute());
|
||||
|
||||
|
||||
@ -111,19 +111,19 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
|
||||
sequences++;
|
||||
|
||||
// DB2 has an additional sequence for the T_TRIGGERS table
|
||||
if (dialect() == DB2 ||
|
||||
dialect() == H2) {
|
||||
if (dialect().family() == DB2 ||
|
||||
dialect().family() == H2) {
|
||||
|
||||
sequences++;
|
||||
}
|
||||
|
||||
// CUBRID generates sequences for AUTO_INCREMENT columns
|
||||
else if (dialect() == CUBRID) {
|
||||
else if (dialect().family() == CUBRID) {
|
||||
sequences += 3;
|
||||
}
|
||||
|
||||
// Oracle has additional sequences for [#961]
|
||||
else if (dialect() == ORACLE) {
|
||||
else if (dialect().family() == ORACLE) {
|
||||
sequences += 5;
|
||||
}
|
||||
}
|
||||
@ -176,7 +176,7 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
|
||||
}
|
||||
// [#643] The U_INVALID types are only available in Oracle
|
||||
// [#799] The member procedure UDT's too
|
||||
else if (dialect() == ORACLE) {
|
||||
else if (dialect().family() == ORACLE) {
|
||||
assertEquals(7, schema.getUDTs().size());
|
||||
}
|
||||
else {
|
||||
@ -330,9 +330,9 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
|
||||
|
||||
// [#745] TODO: Unify distinction between NUMERIC and DECIMAL
|
||||
else if ("BIG_DECIMAL".equalsIgnoreCase(field.getName())
|
||||
&& dialect() != SQLDialect.ORACLE
|
||||
&& dialect() != SQLDialect.POSTGRES
|
||||
&& dialect() != SQLDialect.SQLITE
|
||||
&& dialect().family() != SQLDialect.ORACLE
|
||||
&& dialect().family() != SQLDialect.POSTGRES
|
||||
&& dialect().family() != SQLDialect.SQLITE
|
||||
&& dialect().family() != SQLDialect.SQLSERVER) {
|
||||
|
||||
assertEquals(BigDecimal.class, field.getType());
|
||||
|
||||
@ -192,7 +192,7 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
|
||||
|
||||
// F378, which is a stored function with OUT parameters
|
||||
// ---------------------------------------------------------------------
|
||||
switch (dialect()) {
|
||||
switch (dialect().family()) {
|
||||
|
||||
// Currently, this is only supported for oracle
|
||||
case ORACLE:
|
||||
@ -1207,7 +1207,7 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
|
||||
|
||||
@Test
|
||||
public void testStoredProceduresWithCursorParameters() throws Exception {
|
||||
switch (dialect()) {
|
||||
switch (dialect().family()) {
|
||||
case H2:
|
||||
case HSQLDB:
|
||||
case ORACLE:
|
||||
|
||||
@ -449,7 +449,7 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
|
||||
|
||||
// Check again with limit / offset clauses
|
||||
// ---------------------------------------
|
||||
switch (dialect()) {
|
||||
switch (dialect().family()) {
|
||||
case INGRES:
|
||||
case ORACLE:
|
||||
log.info("SKIPPING", "LIMIT .. OFFSET .. FOR UPDATE");
|
||||
@ -473,7 +473,7 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
|
||||
}
|
||||
}
|
||||
|
||||
switch (dialect()) {
|
||||
switch (dialect().family()) {
|
||||
case ASE:
|
||||
case DB2:
|
||||
case DERBY:
|
||||
@ -498,7 +498,7 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
|
||||
.fetch();
|
||||
assertEquals(2, r1a.size());
|
||||
|
||||
if (dialect() == ORACLE) {
|
||||
if (dialect().family() == ORACLE) {
|
||||
Result<Record1<Integer>> r2a = create()
|
||||
.select(TAuthor_ID())
|
||||
.from(TAuthor())
|
||||
@ -536,7 +536,7 @@ extends BaseTest<A, AP, B, S, B2S, BS, L, X, DATE, BOOL, D, T, U, UU, I, IPK, T7
|
||||
}
|
||||
}
|
||||
|
||||
switch (dialect()) {
|
||||
switch (dialect().family()) {
|
||||
case MARIADB:
|
||||
case MYSQL:
|
||||
case POSTGRES:
|
||||
|
||||
@ -41,7 +41,8 @@ import static org.jooq.SQLDialect.H2;
|
||||
import static org.jooq.SQLDialect.HSQLDB;
|
||||
import static org.jooq.SQLDialect.MARIADB;
|
||||
import static org.jooq.SQLDialect.MYSQL;
|
||||
import static org.jooq.SQLDialect.ORACLE;
|
||||
import static org.jooq.SQLDialect.ORACLE11G;
|
||||
import static org.jooq.SQLDialect.ORACLE12C;
|
||||
import static org.jooq.SQLDialect.POSTGRES;
|
||||
import static org.jooq.SQLDialect.SYBASE;
|
||||
|
||||
@ -64,7 +65,7 @@ public interface GroupConcatOrderByStep extends GroupConcatSeparatorStep {
|
||||
/**
|
||||
* Add an <code>ORDER BY</code> clause to the query
|
||||
*/
|
||||
@Support({ CUBRID, DB2, H2, HSQLDB, MARIADB, MYSQL, ORACLE, POSTGRES, SYBASE })
|
||||
@Support({ CUBRID, DB2, H2, HSQLDB, MARIADB, MYSQL, ORACLE11G, ORACLE12C, POSTGRES, SYBASE })
|
||||
@Transition(
|
||||
name = "ORDER BY",
|
||||
args = "Field+"
|
||||
@ -74,7 +75,7 @@ public interface GroupConcatOrderByStep extends GroupConcatSeparatorStep {
|
||||
/**
|
||||
* Add an <code>ORDER BY</code> clause to the query
|
||||
*/
|
||||
@Support({ CUBRID, DB2, H2, HSQLDB, MARIADB, MYSQL, ORACLE, POSTGRES, SYBASE })
|
||||
@Support({ CUBRID, DB2, H2, HSQLDB, MARIADB, MYSQL, ORACLE11G, ORACLE12C, POSTGRES, SYBASE })
|
||||
@Transition(
|
||||
name = "ORDER BY",
|
||||
args = "SortField+"
|
||||
@ -84,7 +85,7 @@ public interface GroupConcatOrderByStep extends GroupConcatSeparatorStep {
|
||||
/**
|
||||
* Add an <code>ORDER BY</code> clause to the query
|
||||
*/
|
||||
@Support({ CUBRID, DB2, H2, HSQLDB, MARIADB, MYSQL, ORACLE, POSTGRES, SYBASE })
|
||||
@Support({ CUBRID, DB2, H2, HSQLDB, MARIADB, MYSQL, ORACLE11G, ORACLE12C, POSTGRES, SYBASE })
|
||||
@Transition(
|
||||
name = "ORDER BY",
|
||||
args = "SortField+"
|
||||
|
||||
@ -41,7 +41,8 @@ import static org.jooq.SQLDialect.H2;
|
||||
import static org.jooq.SQLDialect.HSQLDB;
|
||||
import static org.jooq.SQLDialect.MARIADB;
|
||||
import static org.jooq.SQLDialect.MYSQL;
|
||||
import static org.jooq.SQLDialect.ORACLE;
|
||||
import static org.jooq.SQLDialect.ORACLE11G;
|
||||
import static org.jooq.SQLDialect.ORACLE12C;
|
||||
import static org.jooq.SQLDialect.POSTGRES;
|
||||
import static org.jooq.SQLDialect.SYBASE;
|
||||
|
||||
@ -61,7 +62,7 @@ public interface GroupConcatSeparatorStep extends AggregateFunction<String> {
|
||||
/**
|
||||
* Specify the separator on the <code>GROUP_CONCAT</code> function
|
||||
*/
|
||||
@Support({ CUBRID, DB2, H2, HSQLDB, MARIADB, MYSQL, ORACLE, POSTGRES, SYBASE })
|
||||
@Support({ CUBRID, DB2, H2, HSQLDB, MARIADB, MYSQL, ORACLE11G, ORACLE12C, POSTGRES, SYBASE })
|
||||
@Transition(
|
||||
name = "SEPARATOR",
|
||||
args = "String"
|
||||
|
||||
@ -35,7 +35,8 @@
|
||||
*/
|
||||
package org.jooq;
|
||||
|
||||
import static org.jooq.SQLDialect.ORACLE;
|
||||
import static org.jooq.SQLDialect.ORACLE11G;
|
||||
import static org.jooq.SQLDialect.ORACLE12C;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@ -72,7 +73,7 @@ public interface OrderedAggregateFunction<T> {
|
||||
* Add an <code>WITHIN GROUP (ORDER BY ..)</code> clause to the ordered
|
||||
* aggregate function
|
||||
*/
|
||||
@Support(ORACLE)
|
||||
@Support({ ORACLE11G, ORACLE12C })
|
||||
@Transition(
|
||||
name = "WITHIN GROUP ORDER BY",
|
||||
args = "Field+",
|
||||
@ -84,7 +85,7 @@ public interface OrderedAggregateFunction<T> {
|
||||
* Add an <code>WITHIN GROUP (ORDER BY ..)</code> clause to the ordered
|
||||
* aggregate function
|
||||
*/
|
||||
@Support(ORACLE)
|
||||
@Support({ ORACLE11G, ORACLE12C })
|
||||
@Transition(
|
||||
name = "WITHIN GROUP ORDER BY",
|
||||
args = "SortField+",
|
||||
@ -96,7 +97,7 @@ public interface OrderedAggregateFunction<T> {
|
||||
* Add an <code>WITHIN GROUP (ORDER BY ..)</code> clause to the ordered
|
||||
* aggregate function
|
||||
*/
|
||||
@Support(ORACLE)
|
||||
@Support({ ORACLE11G, ORACLE12C })
|
||||
@Transition(
|
||||
name = "WITHIN GROUP ORDER BY",
|
||||
args = "SortField+",
|
||||
|
||||
@ -35,7 +35,8 @@
|
||||
*/
|
||||
package org.jooq;
|
||||
|
||||
import static org.jooq.SQLDialect.ORACLE;
|
||||
import static org.jooq.SQLDialect.ORACLE11G;
|
||||
import static org.jooq.SQLDialect.ORACLE12C;
|
||||
|
||||
import org.jooq.api.annotation.State;
|
||||
import org.jooq.api.annotation.Transition;
|
||||
@ -60,7 +61,7 @@ public interface PivotForStep {
|
||||
* @param field The pivoting field
|
||||
* @return A DSL object to create the <code>PIVOT</code> expression
|
||||
*/
|
||||
@Support({ ORACLE })
|
||||
@Support({ ORACLE11G, ORACLE12C })
|
||||
@Transition(
|
||||
name = "FOR",
|
||||
args = "Field"
|
||||
|
||||
@ -35,7 +35,8 @@
|
||||
*/
|
||||
package org.jooq;
|
||||
|
||||
import static org.jooq.SQLDialect.ORACLE;
|
||||
import static org.jooq.SQLDialect.ORACLE11G;
|
||||
import static org.jooq.SQLDialect.ORACLE12C;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@ -59,7 +60,7 @@ public interface PivotInStep<T> {
|
||||
* @param values The pivoting values
|
||||
* @return A new pivoted table
|
||||
*/
|
||||
@Support({ ORACLE })
|
||||
@Support({ ORACLE11G, ORACLE12C })
|
||||
Table<Record> in(T... values);
|
||||
|
||||
/**
|
||||
@ -72,7 +73,7 @@ public interface PivotInStep<T> {
|
||||
* @param fields The pivoting values
|
||||
* @return A new pivoted table
|
||||
*/
|
||||
@Support(ORACLE)
|
||||
@Support({ ORACLE11G, ORACLE12C })
|
||||
@Transition(
|
||||
name = "IN",
|
||||
args = "Field+",
|
||||
@ -90,6 +91,6 @@ public interface PivotInStep<T> {
|
||||
* @param fields The pivoting values
|
||||
* @return A new pivoted table
|
||||
*/
|
||||
@Support(ORACLE)
|
||||
@Support({ ORACLE11G, ORACLE12C })
|
||||
Table<Record> in(Collection<? extends Field<T>> fields);
|
||||
}
|
||||
|
||||
@ -120,6 +120,21 @@ public enum SQLDialect {
|
||||
*/
|
||||
ORACLE("Oracle"),
|
||||
|
||||
/**
|
||||
* The Oracle 10g dialect.
|
||||
*/
|
||||
ORACLE10G("Oracle", ORACLE),
|
||||
|
||||
/**
|
||||
* The Oracle 11g dialect.
|
||||
*/
|
||||
ORACLE11G("Oracle", ORACLE),
|
||||
|
||||
/**
|
||||
* The Oracle 12c dialect.
|
||||
*/
|
||||
ORACLE12C("Oracle", ORACLE),
|
||||
|
||||
/**
|
||||
* The PostgreSQL dialect family.
|
||||
*/
|
||||
|
||||
@ -47,6 +47,8 @@ import static org.jooq.SQLDialect.INGRES;
|
||||
import static org.jooq.SQLDialect.MARIADB;
|
||||
import static org.jooq.SQLDialect.MYSQL;
|
||||
import static org.jooq.SQLDialect.ORACLE;
|
||||
import static org.jooq.SQLDialect.ORACLE11G;
|
||||
import static org.jooq.SQLDialect.ORACLE12C;
|
||||
import static org.jooq.SQLDialect.POSTGRES;
|
||||
import static org.jooq.SQLDialect.SQLSERVER;
|
||||
import static org.jooq.SQLDialect.SYBASE;
|
||||
@ -331,7 +333,7 @@ public interface Table<R extends Record> extends TableLike<R> {
|
||||
* <p>
|
||||
* This has been observed to work with
|
||||
* <ul>
|
||||
* <li> {@link SQLDialect#ORACLE}</li>
|
||||
* <li> {@link SQLDialect#ORACLE11G} upwards</li>
|
||||
* <li> {@link SQLDialect#SQLSERVER} (not yet officially supported)</li>
|
||||
* <li>Other dialects by using some means of simulation (not yet officially
|
||||
* supported)</li>
|
||||
@ -340,7 +342,7 @@ public interface Table<R extends Record> extends TableLike<R> {
|
||||
* @param aggregateFunctions The aggregate functions used for pivoting.
|
||||
* @return A DSL object to create the <code>PIVOT</code> expression
|
||||
*/
|
||||
@Support({ ORACLE })
|
||||
@Support({ ORACLE11G, ORACLE12C })
|
||||
@Transition(
|
||||
name = "PIVOT",
|
||||
args = "Field+"
|
||||
@ -357,7 +359,7 @@ public interface Table<R extends Record> extends TableLike<R> {
|
||||
* @return A DSL object to create the <code>PIVOT</code> expression
|
||||
* @see #pivot(Field...)
|
||||
*/
|
||||
@Support({ ORACLE })
|
||||
@Support({ ORACLE11G, ORACLE12C })
|
||||
@Transition(
|
||||
name = "PIVOT",
|
||||
args = "Field+"
|
||||
|
||||
@ -370,7 +370,7 @@ public abstract class AbstractRoutine<T> extends AbstractQueryPart implements Ro
|
||||
}
|
||||
|
||||
private final void toSQLEnd(RenderContext context) {
|
||||
switch (context.configuration().dialect()) {
|
||||
switch (context.configuration().dialect().family()) {
|
||||
case ORACLE:
|
||||
context.sql(";")
|
||||
.formatIndentEnd()
|
||||
@ -385,7 +385,7 @@ public abstract class AbstractRoutine<T> extends AbstractQueryPart implements Ro
|
||||
}
|
||||
|
||||
private final void toSQLBegin(RenderContext context) {
|
||||
switch (context.configuration().dialect()) {
|
||||
switch (context.configuration().dialect().family()) {
|
||||
case ORACLE:
|
||||
context.keyword("begin")
|
||||
.formatIndentStart()
|
||||
@ -399,7 +399,7 @@ public abstract class AbstractRoutine<T> extends AbstractQueryPart implements Ro
|
||||
}
|
||||
|
||||
private final void toSQLAssign(RenderContext context) {
|
||||
switch (context.configuration().dialect()) {
|
||||
switch (context.configuration().dialect().family()) {
|
||||
case ORACLE:
|
||||
context.sql("? := ");
|
||||
break;
|
||||
@ -411,7 +411,7 @@ public abstract class AbstractRoutine<T> extends AbstractQueryPart implements Ro
|
||||
}
|
||||
|
||||
private final void toSQLCall(RenderContext context) {
|
||||
switch (context.configuration().dialect()) {
|
||||
switch (context.configuration().dialect().family()) {
|
||||
case ORACLE:
|
||||
break;
|
||||
|
||||
@ -424,7 +424,7 @@ public abstract class AbstractRoutine<T> extends AbstractQueryPart implements Ro
|
||||
}
|
||||
|
||||
private final void toSQLOutParam(RenderContext context, Parameter<?> parameter) {
|
||||
switch (context.configuration().dialect()) {
|
||||
switch (context.configuration().dialect().family()) {
|
||||
case ORACLE:
|
||||
context.sql(parameter);
|
||||
context.sql(" => ");
|
||||
@ -438,7 +438,7 @@ public abstract class AbstractRoutine<T> extends AbstractQueryPart implements Ro
|
||||
}
|
||||
|
||||
private final void toSQLInParam(RenderContext context, Parameter<?> parameter, Field<?> value) {
|
||||
switch (context.configuration().dialect()) {
|
||||
switch (context.configuration().dialect().family()) {
|
||||
case ORACLE:
|
||||
context.sql(parameter);
|
||||
context.sql(" => ");
|
||||
@ -498,7 +498,7 @@ public abstract class AbstractRoutine<T> extends AbstractQueryPart implements Ro
|
||||
int index = parameterIndexes.get(parameter);
|
||||
int sqlType = parameter.getDataType().getDataType(c).getSQLType();
|
||||
|
||||
switch (c.dialect()) {
|
||||
switch (c.dialect().family()) {
|
||||
|
||||
// For some user defined types Oracle needs to bind
|
||||
// also the type name
|
||||
|
||||
@ -119,7 +119,7 @@ class Alias<Q extends QueryPart> extends AbstractQueryPart {
|
||||
// [#1801] Some databases do not support "derived column names".
|
||||
// They can be simulated by concatenating a dummy SELECT with no
|
||||
// results using UNION ALL
|
||||
else if (fieldAliases != null && asList(H2, MARIADB, MYSQL, ORACLE, SQLITE).contains(dialect)) {
|
||||
else if (fieldAliases != null && asList(H2, MARIADB, MYSQL, ORACLE, SQLITE).contains(dialect.family())) {
|
||||
simulateDerivedColumnList = true;
|
||||
|
||||
SelectFieldList fields = new SelectFieldList();
|
||||
|
||||
@ -174,7 +174,7 @@ class ArrayTable extends AbstractTable<Record> {
|
||||
}
|
||||
|
||||
private final Table<Record> table(Configuration configuration) {
|
||||
switch (configuration.dialect()) {
|
||||
switch (configuration.dialect().family()) {
|
||||
case ORACLE: {
|
||||
if (array.getDataType().getType().isArray()) {
|
||||
return simulate().as(alias);
|
||||
|
||||
@ -76,7 +76,7 @@ enum CombineOperator {
|
||||
|
||||
public String toSQL(SQLDialect dialect) {
|
||||
if (this == EXCEPT) {
|
||||
if (dialect == SQLDialect.ORACLE) {
|
||||
if (dialect.family() == SQLDialect.ORACLE) {
|
||||
return "minus";
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ class Cot extends AbstractFunction<BigDecimal> {
|
||||
|
||||
@Override
|
||||
final Field<BigDecimal> getFunction0(Configuration configuration) {
|
||||
switch (configuration.dialect()) {
|
||||
switch (configuration.dialect().family()) {
|
||||
case INGRES:
|
||||
case ORACLE:
|
||||
return DSL.cos(argument).div(DSL.sin(argument));
|
||||
|
||||
@ -46,6 +46,8 @@ import static org.jooq.SQLDialect.INGRES;
|
||||
import static org.jooq.SQLDialect.MARIADB;
|
||||
import static org.jooq.SQLDialect.MYSQL;
|
||||
import static org.jooq.SQLDialect.ORACLE;
|
||||
import static org.jooq.SQLDialect.ORACLE11G;
|
||||
import static org.jooq.SQLDialect.ORACLE12C;
|
||||
import static org.jooq.SQLDialect.POSTGRES;
|
||||
import static org.jooq.SQLDialect.SQLITE;
|
||||
import static org.jooq.SQLDialect.SQLSERVER;
|
||||
@ -9992,8 +9994,8 @@ public class DSL {
|
||||
/**
|
||||
* Get the aggregated concatenation for a field.
|
||||
* <p>
|
||||
* This is natively supported by {@link SQLDialect#ORACLE}. It is simulated
|
||||
* by the following dialects:
|
||||
* This is natively supported by {@link SQLDialect#ORACLE11G} upwards. It is
|
||||
* simulated by the following dialects:
|
||||
* <ul>
|
||||
* <li> {@link SQLDialect#CUBRID}: Using <code>GROUP_CONCAT()</code></li>
|
||||
* <li> {@link SQLDialect#DB2}: Using <code>XMLAGG()</code></li>
|
||||
@ -10006,7 +10008,7 @@ public class DSL {
|
||||
*
|
||||
* @see #groupConcat(Field)
|
||||
*/
|
||||
@Support({ CUBRID, DB2, H2, HSQLDB, MARIADB, MYSQL, ORACLE, POSTGRES, SYBASE })
|
||||
@Support({ CUBRID, DB2, H2, HSQLDB, MARIADB, MYSQL, ORACLE11G, ORACLE12C, POSTGRES, SYBASE })
|
||||
@Transition(
|
||||
name = "LISTAGG",
|
||||
args = "Field"
|
||||
@ -10018,8 +10020,8 @@ public class DSL {
|
||||
/**
|
||||
* Get the aggregated concatenation for a field.
|
||||
* <p>
|
||||
* This is natively supported by {@link SQLDialect#ORACLE}. It is simulated
|
||||
* by the following dialects:
|
||||
* This is natively supported by {@link SQLDialect#ORACLE11G} upwards. It is
|
||||
* simulated by the following dialects:
|
||||
* <ul>
|
||||
* <li> {@link SQLDialect#CUBRID}: Using <code>GROUP_CONCAT</code></li>
|
||||
* <li> {@link SQLDialect#DB2}: Using <code>XMLAGG()</code></li>
|
||||
@ -10032,7 +10034,7 @@ public class DSL {
|
||||
*
|
||||
* @see #groupConcat(Field)
|
||||
*/
|
||||
@Support({ CUBRID, DB2, H2, HSQLDB, MARIADB, MYSQL, ORACLE, POSTGRES, SYBASE })
|
||||
@Support({ CUBRID, DB2, H2, HSQLDB, MARIADB, MYSQL, ORACLE11G, ORACLE12C, POSTGRES, SYBASE })
|
||||
@Transition(
|
||||
name = "LISTAGG",
|
||||
args = {
|
||||
|
||||
@ -68,7 +68,7 @@ class Decode<T, Z> extends AbstractFunction<Z> {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
final Field<Z> getFunction0(Configuration configuration) {
|
||||
switch (configuration.dialect()) {
|
||||
switch (configuration.dialect().family()) {
|
||||
|
||||
// Oracle actually has this function
|
||||
case ORACLE: {
|
||||
|
||||
@ -458,7 +458,7 @@ public class DefaultDataType<T> implements DataType<T> {
|
||||
return Types.STRUCT;
|
||||
}
|
||||
else if (Result.class.isAssignableFrom(type)) {
|
||||
switch (dialect) {
|
||||
switch (dialect.family()) {
|
||||
case ORACLE:
|
||||
case H2:
|
||||
return -10; // OracleTypes.CURSOR;
|
||||
|
||||
@ -64,7 +64,7 @@ class Degrees extends AbstractFunction<BigDecimal> {
|
||||
|
||||
@Override
|
||||
final Field<BigDecimal> getFunction0(Configuration configuration) {
|
||||
switch (configuration.dialect()) {
|
||||
switch (configuration.dialect().family()) {
|
||||
case FIREBIRD:
|
||||
case INGRES:
|
||||
case ORACLE:
|
||||
|
||||
@ -126,57 +126,57 @@ class Expression<T> extends AbstractFunction<T> {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
final Field<T> getFunction0(Configuration configuration) {
|
||||
SQLDialect dialect = configuration.dialect();
|
||||
SQLDialect family = configuration.dialect().family();
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// XXX: Bitwise operators
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
// DB2, H2 and HSQLDB know functions, instead of operators
|
||||
if (BIT_AND == operator && asList(DB2, H2, HSQLDB, ORACLE).contains(dialect)) {
|
||||
if (BIT_AND == operator && asList(DB2, H2, HSQLDB, ORACLE).contains(family)) {
|
||||
return function("bitand", getDataType(), getArguments());
|
||||
}
|
||||
else if (BIT_AND == operator && FIREBIRD == dialect) {
|
||||
else if (BIT_AND == operator && FIREBIRD == family) {
|
||||
return function("bin_and", getDataType(), getArguments());
|
||||
}
|
||||
else if (BIT_XOR == operator && asList(DB2, H2, HSQLDB).contains(dialect)) {
|
||||
else if (BIT_XOR == operator && asList(DB2, H2, HSQLDB).contains(family)) {
|
||||
return function("bitxor", getDataType(), getArguments());
|
||||
}
|
||||
else if (BIT_XOR == operator && FIREBIRD == dialect) {
|
||||
else if (BIT_XOR == operator && FIREBIRD == family) {
|
||||
return function("bin_xor", getDataType(), getArguments());
|
||||
}
|
||||
else if (BIT_OR == operator && asList(DB2, H2, HSQLDB).contains(dialect)) {
|
||||
else if (BIT_OR == operator && asList(DB2, H2, HSQLDB).contains(family)) {
|
||||
return function("bitor", getDataType(), getArguments());
|
||||
}
|
||||
else if (BIT_OR == operator && FIREBIRD == dialect) {
|
||||
else if (BIT_OR == operator && FIREBIRD == family) {
|
||||
return function("bin_or", getDataType(), getArguments());
|
||||
}
|
||||
|
||||
// Oracle has to simulate or/xor
|
||||
else if (BIT_OR == operator && ORACLE == dialect) {
|
||||
else if (BIT_OR == operator && ORACLE == family) {
|
||||
return lhs.sub(bitAnd(lhsAsNumber(), rhsAsNumber())).add(rhsAsNumber());
|
||||
}
|
||||
|
||||
// ~(a & b) & (a | b)
|
||||
else if (BIT_XOR == operator && asList(ORACLE, SQLITE).contains(dialect)) {
|
||||
else if (BIT_XOR == operator && asList(ORACLE, SQLITE).contains(family)) {
|
||||
return (Field<T>) bitAnd(
|
||||
bitNot(bitAnd(lhsAsNumber(), rhsAsNumber())),
|
||||
bitOr(lhsAsNumber(), rhsAsNumber()));
|
||||
}
|
||||
|
||||
// Many dialects don't support shifts. Use multiplication/division instead
|
||||
else if (SHL == operator && asList(ASE, DB2, H2, HSQLDB, INGRES, ORACLE, SQLSERVER, SYBASE).contains(dialect.family())) {
|
||||
else if (SHL == operator && asList(ASE, DB2, H2, HSQLDB, INGRES, ORACLE, SQLSERVER, SYBASE).contains(family.family())) {
|
||||
return lhs.mul(DSL.power(two(), rhsAsNumber()));
|
||||
}
|
||||
else if (SHR == operator && asList(ASE, DB2, H2, HSQLDB, INGRES, ORACLE, SQLSERVER, SYBASE).contains(dialect.family())) {
|
||||
else if (SHR == operator && asList(ASE, DB2, H2, HSQLDB, INGRES, ORACLE, SQLSERVER, SYBASE).contains(family.family())) {
|
||||
return lhs.div(DSL.power(two(), rhsAsNumber()));
|
||||
}
|
||||
|
||||
// Some dialects support shifts as functions
|
||||
else if (SHL == operator && FIREBIRD == dialect) {
|
||||
else if (SHL == operator && FIREBIRD == family) {
|
||||
return function("bin_shl", getDataType(), getArguments());
|
||||
}
|
||||
else if (SHR == operator && FIREBIRD == dialect) {
|
||||
else if (SHR == operator && FIREBIRD == family) {
|
||||
return function("bin_shr", getDataType(), getArguments());
|
||||
}
|
||||
|
||||
|
||||
@ -77,7 +77,7 @@ class FieldMapsForInsert extends AbstractQueryPart {
|
||||
|
||||
// True SQL92 multi-record inserts aren't always supported
|
||||
else {
|
||||
switch (context.configuration().dialect()) {
|
||||
switch (context.configuration().dialect().family()) {
|
||||
|
||||
// Some dialects don't support multi-record inserts
|
||||
case ASE:
|
||||
|
||||
@ -299,7 +299,10 @@ class Limit extends AbstractQueryPart {
|
||||
|
||||
// Oracle knows no LIMIT or TOP clause, limits are always bound
|
||||
// ------------------------------------------------------------
|
||||
case ORACLE: {
|
||||
case ORACLE:
|
||||
case ORACLE10G:
|
||||
case ORACLE11G:
|
||||
case ORACLE12C: {
|
||||
|
||||
// [#1020] With the ROWNUM filtering improvement, the upper
|
||||
// limit is bound before the lower limit
|
||||
|
||||
@ -60,7 +60,7 @@ class MD5 extends AbstractFunction<String> {
|
||||
|
||||
@Override
|
||||
final Field<String> getFunction0(Configuration configuration) {
|
||||
switch (configuration.dialect()) {
|
||||
switch (configuration.dialect().family()) {
|
||||
case ORACLE:
|
||||
return field("{lower}({rawtohex}({sys}.{dbms_crypto}.{hash}({utl_raw}.{cast_to_raw}({0}), 2)))", SQLDataType.VARCHAR, argument);
|
||||
case MARIADB:
|
||||
|
||||
@ -102,7 +102,7 @@ class MetaDataFieldProvider implements Serializable {
|
||||
String type = meta.getColumnTypeName(i);
|
||||
|
||||
try {
|
||||
dataType = DefaultDataType.getDataType(configuration.dialect(), type, precision, scale);
|
||||
dataType = DefaultDataType.getDataType(configuration.dialect().family(), type, precision, scale);
|
||||
|
||||
if (dataType.hasPrecision()) {
|
||||
dataType = dataType.precision(precision);
|
||||
|
||||
@ -252,7 +252,7 @@ class MetaImpl implements Meta, Serializable {
|
||||
try {
|
||||
String[] types = null;
|
||||
|
||||
switch (configuration.dialect()) {
|
||||
switch (configuration.dialect().family()) {
|
||||
|
||||
// [#2323] SQLite JDBC drivers have a bug. They return other
|
||||
// object types, too: https://bitbucket.org/xerial/sqlite-jdbc/issue/68
|
||||
|
||||
@ -73,7 +73,7 @@ class Neg<T> extends AbstractField<T> {
|
||||
public final void toSQL(RenderContext context) {
|
||||
SQLDialect dialect = context.configuration().dialect();
|
||||
|
||||
if (operator == BIT_NOT && asList(H2, HSQLDB, INGRES, ORACLE).contains(dialect)) {
|
||||
if (operator == BIT_NOT && asList(H2, HSQLDB, INGRES, ORACLE).contains(dialect.family())) {
|
||||
context.sql("(0 -")
|
||||
.sql(field)
|
||||
.sql(" - 1)");
|
||||
|
||||
@ -62,7 +62,7 @@ class Nvl<T> extends AbstractFunction<T> {
|
||||
|
||||
@Override
|
||||
final Field<T> getFunction0(Configuration configuration) {
|
||||
switch (configuration.dialect()) {
|
||||
switch (configuration.dialect().family()) {
|
||||
case DB2:
|
||||
case H2:
|
||||
case HSQLDB:
|
||||
|
||||
@ -64,7 +64,7 @@ class Nvl2<T> extends AbstractFunction<T> {
|
||||
|
||||
@Override
|
||||
final Field<T> getFunction0(Configuration configuration) {
|
||||
switch (configuration.dialect()) {
|
||||
switch (configuration.dialect().family()) {
|
||||
case H2:
|
||||
case HSQLDB:
|
||||
case INGRES:
|
||||
|
||||
@ -61,7 +61,7 @@ class Pi extends AbstractFunction<BigDecimal> {
|
||||
|
||||
@Override
|
||||
final Field<BigDecimal> getFunction0(Configuration configuration) {
|
||||
switch (configuration.dialect()) {
|
||||
switch (configuration.dialect().family()) {
|
||||
case DB2:
|
||||
case ORACLE:
|
||||
return DSL.asin(one()).mul(two());
|
||||
|
||||
@ -107,7 +107,9 @@ implements
|
||||
switch (configuration.dialect()) {
|
||||
|
||||
// Oracle has native support for the PIVOT clause
|
||||
case ORACLE: {
|
||||
case ORACLE:
|
||||
case ORACLE11G:
|
||||
case ORACLE12C: {
|
||||
return new OraclePivotTable();
|
||||
}
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ class Radians extends AbstractFunction<BigDecimal> {
|
||||
|
||||
@Override
|
||||
final Field<BigDecimal> getFunction0(Configuration configuration) {
|
||||
switch (configuration.dialect()) {
|
||||
switch (configuration.dialect().family()) {
|
||||
case FIREBIRD:
|
||||
case INGRES:
|
||||
case ORACLE:
|
||||
|
||||
@ -59,7 +59,7 @@ class Rand extends AbstractFunction<BigDecimal> {
|
||||
|
||||
@Override
|
||||
final Field<BigDecimal> getFunction0(Configuration configuration) {
|
||||
switch (configuration.dialect()) {
|
||||
switch (configuration.dialect().family()) {
|
||||
case DERBY:
|
||||
case INGRES:
|
||||
case POSTGRES:
|
||||
|
||||
@ -181,7 +181,7 @@ class RowCondition extends AbstractCondition {
|
||||
public final void toSQL(RenderContext context) {
|
||||
|
||||
// Some dialects do not support != comparison with rows
|
||||
if (comparator == NOT_EQUALS && asList(DB2).contains(context.configuration().dialect())) {
|
||||
if (comparator == NOT_EQUALS && asList(DB2).contains(context.configuration().dialect().family())) {
|
||||
context.keyword("not(")
|
||||
.sql(left)
|
||||
.sql(" = ")
|
||||
@ -190,7 +190,7 @@ class RowCondition extends AbstractCondition {
|
||||
}
|
||||
else {
|
||||
// Some databases need extra parentheses around the RHS
|
||||
boolean extraParentheses = asList(ORACLE).contains(context.configuration().dialect());
|
||||
boolean extraParentheses = asList(ORACLE).contains(context.configuration().dialect().family());
|
||||
|
||||
context.sql(left)
|
||||
.sql(" ")
|
||||
|
||||
@ -101,17 +101,17 @@ class RowSubqueryCondition extends AbstractCondition {
|
||||
}
|
||||
|
||||
private final QueryPartInternal delegate(Configuration configuration, RenderContext context) {
|
||||
SQLDialect dialect = configuration.dialect();
|
||||
SQLDialect family = configuration.dialect().family();
|
||||
|
||||
// [#2395] These dialects have full native support for comparison
|
||||
// predicates with row value expressions and subqueries:
|
||||
if (asList(H2, HSQLDB, MARIADB, MYSQL, POSTGRES).contains(dialect)) {
|
||||
if (asList(H2, HSQLDB, MARIADB, MYSQL, POSTGRES).contains(family)) {
|
||||
return new Native();
|
||||
}
|
||||
|
||||
// [#2395] These dialects have native support for = and <>
|
||||
else if (
|
||||
asList(H2, HSQLDB, MARIADB, MYSQL, ORACLE, POSTGRES).contains(dialect) &&
|
||||
asList(H2, HSQLDB, MARIADB, MYSQL, ORACLE, POSTGRES).contains(family) &&
|
||||
asList(EQUALS, NOT_EQUALS).contains(comparator)) {
|
||||
|
||||
return new Native();
|
||||
@ -119,7 +119,7 @@ class RowSubqueryCondition extends AbstractCondition {
|
||||
|
||||
// [#2395] These dialects have native support for IN and NOT IN
|
||||
else if (
|
||||
asList(H2, DB2, HSQLDB, MARIADB, MYSQL, ORACLE, POSTGRES).contains(dialect) &&
|
||||
asList(H2, DB2, HSQLDB, MARIADB, MYSQL, ORACLE, POSTGRES).contains(family) &&
|
||||
asList(IN, NOT_IN).contains(comparator)) {
|
||||
|
||||
return new Native();
|
||||
@ -193,7 +193,7 @@ class RowSubqueryCondition extends AbstractCondition {
|
||||
public final void toSQL(RenderContext context) {
|
||||
|
||||
// Some databases need extra parentheses around the RHS
|
||||
boolean extraParentheses = asList(ORACLE).contains(context.configuration().dialect());
|
||||
boolean extraParentheses = asList(ORACLE).contains(context.configuration().dialect().family());
|
||||
boolean subquery = context.subquery();
|
||||
|
||||
context.sql(left)
|
||||
|
||||
@ -187,6 +187,9 @@ class SelectQueryImpl<R extends Record> extends AbstractSelect<R> implements Sel
|
||||
|
||||
// Oracle knows the ROWNUM pseudo-column. That makes things simple
|
||||
case ORACLE:
|
||||
case ORACLE10G:
|
||||
case ORACLE11G:
|
||||
case ORACLE12C:
|
||||
toSQLReferenceLimitOracle(context);
|
||||
break;
|
||||
|
||||
@ -267,7 +270,7 @@ class SelectQueryImpl<R extends Record> extends AbstractSelect<R> implements Sel
|
||||
else if (!forUpdateOfTables.isEmpty()) {
|
||||
context.keyword(" of ");
|
||||
|
||||
switch (context.configuration().dialect()) {
|
||||
switch (context.configuration().dialect().family()) {
|
||||
|
||||
// Some dialects don't allow for an OF [table-names] clause
|
||||
// It can be simulated by listing the table's fields, though
|
||||
|
||||
@ -60,7 +60,7 @@ class UDTConstant<R extends UDTRecord<R>> extends AbstractParam<R> {
|
||||
|
||||
@Override
|
||||
public final void toSQL(RenderContext context) {
|
||||
switch (context.configuration().dialect()) {
|
||||
switch (context.configuration().dialect().family()) {
|
||||
|
||||
// Oracle supports java.sql.SQLData, hence the record can be bound
|
||||
// to the CallableStatement directly
|
||||
@ -123,7 +123,7 @@ class UDTConstant<R extends UDTRecord<R>> extends AbstractParam<R> {
|
||||
|
||||
private String getInlineConstructor(RenderContext context) {
|
||||
// TODO [#884] Fix this with a local render context (using ctx.literal)
|
||||
switch (context.configuration().dialect()) {
|
||||
switch (context.configuration().dialect().family()) {
|
||||
case POSTGRES:
|
||||
return "ROW";
|
||||
|
||||
@ -147,7 +147,7 @@ class UDTConstant<R extends UDTRecord<R>> extends AbstractParam<R> {
|
||||
|
||||
@Override
|
||||
public final void bind(BindContext context) {
|
||||
switch (context.configuration().dialect()) {
|
||||
switch (context.configuration().dialect().family()) {
|
||||
|
||||
// Oracle supports java.sql.SQLData, hence the record can be bound
|
||||
// to the CallableStatement directly
|
||||
|
||||
@ -463,7 +463,7 @@ class UpdateQueryImpl<R extends Record> extends AbstractStoreQuery<R> implements
|
||||
|
||||
// Some dialects don't really support row value expressions on the
|
||||
// right hand side of a SET clause
|
||||
if (multiValue != null && !asList(INGRES, ORACLE).contains(context.configuration().dialect())) {
|
||||
if (multiValue != null && !asList(INGRES, ORACLE).contains(context.configuration().dialect().family())) {
|
||||
context.sql(multiValue);
|
||||
}
|
||||
|
||||
|
||||
@ -173,7 +173,7 @@ class Val<T> extends AbstractParam<T> {
|
||||
// the safe side, always cast these types in those dialects that support
|
||||
// them
|
||||
if (getDataType().isInterval()) {
|
||||
switch (context.configuration().dialect()) {
|
||||
switch (context.configuration().dialect().family()) {
|
||||
case ORACLE:
|
||||
case POSTGRES:
|
||||
return true;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user