Skip to content

Commit

Permalink
[3.0] Oracle 23 platform - backport from master
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaypaul-ibm committed Jun 26, 2024
1 parent 0f69952 commit f847a79
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -65,7 +65,7 @@ public void test() {
preConnectionsAvailable = serverSession.getReadConnectionPool().getConnectionsAvailable().size();
try {
DataReadQuery query = new DataReadQuery();
String sqlString = "SELECT SUM(e.EMP_ID) from EMPLOYEE e , EMPLOYEE b, EMPLOYEE c, EMPLOYEE d, EMPLOYEE f, EMPLOYEE g, EMPLOYEE h";
String sqlString = "SELECT SUM(e.EMP_ID) from EMPLOYEE e , EMPLOYEE b, EMPLOYEE c, EMPLOYEE d, EMPLOYEE f, EMPLOYEE g, EMPLOYEE h, EMPLOYEE g";
query.setSQLString(sqlString);
query.setQueryTimeout(1);
query.useCursoredStream(1, 1);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -46,7 +46,7 @@ public void test() {
}
try {
DataReadQuery query = new DataReadQuery();
query.setSQLString("SELECT SUM(e.EMP_ID) from EMPLOYEE e , EMPLOYEE b, EMPLOYEE c, EMPLOYEE d, EMPLOYEE f, EMPLOYEE g, EMPLOYEE h");
query.setSQLString("SELECT SUM(e.EMP_ID) from EMPLOYEE e , EMPLOYEE b, EMPLOYEE c, EMPLOYEE d, EMPLOYEE f, EMPLOYEE g, EMPLOYEE h, EMPLOYEE g");
query.setQueryTimeout(1);
getSession().executeQuery(query);
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 1998, 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2022 IBM Corporation. All rights reserved.
* Copyright (c) 1998, 2024 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2024 IBM Corporation. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -298,6 +298,12 @@ public void setConversionManager(ConversionManager conversionManager) {
public String getEndDelimiter() {
return endDelimiter;
}
/**
* Return the driver version.
*/
public String getDriverVersion() {
return "";
}

/**
* Delimiter to use for fields and tables using spaces or other special values.
Expand Down Expand Up @@ -652,6 +658,10 @@ public boolean isOracle12() {
return false;
}

@Override
public boolean isOracle23() {
return false;
}
public boolean isPervasive(){
return false;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 1998, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019 IBM Corporation. All rights reserved.
* Copyright (c) 1998, 2024 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024 IBM Corporation. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -68,6 +68,11 @@ public interface Platform extends CorePlatform<ConversionManager>, Serializable,
*/
void setConversionManager(ConversionManager conversionManager);

/**
* Return the driver version.
*/
String getDriverVersion();

/**
* Return the qualifier for the table. Required by some
* databases such as Oracle and DB2
Expand Down Expand Up @@ -118,6 +123,8 @@ public interface Platform extends CorePlatform<ConversionManager>, Serializable,

boolean isOracle9();

boolean isOracle23();

boolean isOracle12();

boolean isPointBase();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0,
* or the Eclipse Distribution License v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/

// Contributors:
// Oracle - initial API and implementation
package org.eclipse.persistence.platform.database;

public class Oracle23Platform extends Oracle21Platform {
public Oracle23Platform() {
super();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
import org.eclipse.persistence.internal.sessions.AbstractRecord;
import org.eclipse.persistence.internal.sessions.AbstractSession;
import org.eclipse.persistence.mappings.structures.ObjectRelationalDatabaseField;
import org.eclipse.persistence.platform.database.DatabasePlatform;
import org.eclipse.persistence.platform.database.jdbc.JDBCTypes;
import org.eclipse.persistence.platform.database.oracle.jdbc.OracleArrayType;
import org.eclipse.persistence.queries.StoredProcedureCall;
import org.eclipse.persistence.sessions.DatabaseRecord;
Expand Down Expand Up @@ -488,6 +490,7 @@ public void useNamedCursorOutputAsResultSet(String argumentName, DatabaseType da
protected void assignIndices() {
List<PLSQLargument> inArguments = getArguments(arguments, ParameterType.IN);
List<PLSQLargument> inOutArguments = getArguments(arguments, ParameterType.INOUT);
DatabasePlatform platform = this.getQuery().getSession().getPlatform();
inArguments.addAll(inOutArguments);
int newIndex = 1;
List<PLSQLargument> expandedArguments = new ArrayList<>();
Expand All @@ -509,6 +512,10 @@ protected void assignIndices() {
}
for (PLSQLargument inArg : inArguments) {
DatabaseType type = inArg.databaseType;
if (platform.isOracle23() && type == OraclePLSQLTypes.PLSQLBoolean && Helper.compareVersions(platform.getDriverVersion(), "23.0.0") >= 0) {
type = JDBCTypes.BOOLEAN_TYPE;
inArg.databaseType = JDBCTypes.BOOLEAN_TYPE;
}
String inArgName = inArg.name;
if (!type.isComplexDatabaseType()) {
// for XMLType, we need to set type name parameter (will be "XMLTYPE")
Expand Down Expand Up @@ -562,6 +569,10 @@ protected void assignIndices() {
super.useNamedCursorOutputAsResultSet(outArgName);
} else {
DatabaseType type = outArg.databaseType;
if (platform.isOracle23() && type == OraclePLSQLTypes.PLSQLBoolean && Helper.compareVersions(platform.getDriverVersion(), "23.0.0") >= 0) {
type = JDBCTypes.BOOLEAN_TYPE;
outArg.databaseType = JDBCTypes.BOOLEAN_TYPE;
}
if (!type.isComplexDatabaseType()) {
// for XMLType, we need to set type name parameter (will be "XMLTYPE")
if (type == XMLType) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# Copyright (c) 1998, 2019 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1998, 2019 IBM Corporation. All rights reserved.
# Copyright (c) 1998, 2024 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1998, 2024 IBM Corporation. All rights reserved.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -36,13 +36,15 @@
# to platform class entries should be placed before less specific entries. Each
# platform entry must be on its own line, an entry cannot span multiple lines.

(?is)oracle.*23.*=org.eclipse.persistence.platform.database.oracle.Oracle23Platform
(?is)oracle.*21.*=org.eclipse.persistence.platform.database.oracle.Oracle21Platform
(?is)oracle.*19.*=org.eclipse.persistence.platform.database.oracle.Oracle19Platform
(?is)oracle.*18.*=org.eclipse.persistence.platform.database.oracle.Oracle18Platform
(?is)oracle.*12.*=org.eclipse.persistence.platform.database.oracle.Oracle12Platform
(?is)oracle.*11.*=org.eclipse.persistence.platform.database.oracle.Oracle11Platform
(?is)oracle.*10.*=org.eclipse.persistence.platform.database.oracle.Oracle10Platform
(?is)oracle.*9.*=org.eclipse.persistence.platform.database.oracle.Oracle9Platform
(?is)core.oracle.*23.*=org.eclipse.persistence.platform.database.Oracle23Platform
(?is)core.oracle.*21.*=org.eclipse.persistence.platform.database.Oracle21Platform
(?is)core.oracle.*19.*=org.eclipse.persistence.platform.database.Oracle19Platform
(?is)core.oracle.*18.*=org.eclipse.persistence.platform.database.Oracle18Platform
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright (c) 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0,
* or the Eclipse Distribution License v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/

// Contributors:
// Oracle - initial API and implementation
package org.eclipse.persistence.platform.database.oracle;

/**
* <p><b>Purpose:</b>
* Supports certain new Oracle 23c data types, and usage of certain Oracle JDBC specific APIs.
* <p> Supports Oracle JSON data type.
* <p> Supports Oracle OracleJsonValue derived Java types.
*/
public class Oracle23Platform extends Oracle21Platform {

/**
* Creates an instance of Oracle 23c database platform.
*/
public Oracle23Platform() {
super();
}


/**
* INTERNAL:
* Check whether current platform is Oracle 23c or later.
* @return Always returns {@code true} for instances of Oracle 23c platform.
* @since 3.0.5
*/
@Override
public boolean isOracle23() {
return true;
}
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
<pgsql.version>42.2.18</pgsql.version>
<!-- CQ #21139, 21140 -->
<logback.version>1.3.0-alpha5</logback.version>
<oracle.jdbc.version>21.3.0.0</oracle.jdbc.version>
<oracle.jdbc.version>23.2.0.0</oracle.jdbc.version>
<!-- CQ #2437 -->
<oracle.aqapi.version>19.3.0.0</oracle.aqapi.version>
<oracle.fmw.version>12.2.1-2-0</oracle.fmw.version>
Expand Down

0 comments on commit f847a79

Please sign in to comment.