From 03380b531dc4a3bf7eddf933976e051aa7be269a Mon Sep 17 00:00:00 2001 From: Adam Retter Date: Wed, 31 Dec 2025 17:45:26 +0100 Subject: [PATCH] [feature] Enable the sql-oracle module as ojdbc is now freely available from Maven Central --- extensions/modules/pom.xml | 2 +- extensions/modules/sql-oracle/pom.xml | 20 +++---- .../modules/oracle/ExecuteFunction.java | 52 ++++++++++++----- .../xquery/modules/oracle/OracleModule.java | 57 ++++++++++++++++--- 4 files changed, 94 insertions(+), 37 deletions(-) diff --git a/extensions/modules/pom.xml b/extensions/modules/pom.xml index 74c2780b6c..056d4ae1f9 100644 --- a/extensions/modules/pom.xml +++ b/extensions/modules/pom.xml @@ -87,7 +87,7 @@ scheduler simpleql sql - + sql-oracle xmldiff xslfo diff --git a/extensions/modules/sql-oracle/pom.xml b/extensions/modules/sql-oracle/pom.xml index 122e88aa69..a5e5872b7d 100644 --- a/extensions/modules/sql-oracle/pom.xml +++ b/extensions/modules/sql-oracle/pom.xml @@ -101,6 +101,7 @@ pom.xml + src/main/java/** @@ -111,6 +112,7 @@
${project.parent.relativePath}/../../exist-parent/existdb-LGPL-21-license.template.txt
pom.xml + src/main/java/** @@ -131,6 +133,11 @@ exist-core ${project.version} + + xyz.elemental.fork.org.exist-db + exist-sql + ${project.version} + com.oracle.database.jdbc @@ -145,17 +152,4 @@ - - - maven.oracle.com - oracle-maven-repo - https://maven.oracle.com - default - - true - always - - - - diff --git a/extensions/modules/sql-oracle/src/main/java/org/exist/xquery/modules/oracle/ExecuteFunction.java b/extensions/modules/sql-oracle/src/main/java/org/exist/xquery/modules/oracle/ExecuteFunction.java index a3167b8bce..0978c47796 100644 --- a/extensions/modules/sql-oracle/src/main/java/org/exist/xquery/modules/oracle/ExecuteFunction.java +++ b/extensions/modules/sql-oracle/src/main/java/org/exist/xquery/modules/oracle/ExecuteFunction.java @@ -1,4 +1,28 @@ /* + * Elemental + * Copyright (C) 2024, Evolved Binary Ltd + * + * admin@evolvedbinary.com + * https://www.evolvedbinary.com | https://www.elemental.xyz + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; version 2.1. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * NOTE: Parts of this file contain code from 'The eXist-db Authors'. + * The original license header is included below. + * + * ===================================================================== + * * eXist-db Open Source Native XML Database * Copyright (C) 2001 The eXist-db Authors * @@ -65,16 +89,13 @@ import org.w3c.dom.NodeList; /** - * eXist Oracle Module Extension ExecuteFunction + * eXist-db Oracle Module Extension ExecuteFunction * * Execute a PL/SQL stored procedure within an Oracle RDBMS. * * @author Robert Walpole * @serial 2009-03-23 * @version 1.0 - * - * @see org.exist.xquery.BasicFunction#BasicFunction(org.exist.xquery.XQueryContext, - * org.exist.xquery.FunctionSignature) */ public class ExecuteFunction extends BasicFunction { @@ -124,17 +145,17 @@ public class ExecuteFunction extends BasicFunction { private final static String TYPE_ATTRIBUTE_NAME = "type"; private final static String POSITION_ATTRIBUTE_NAME = "pos"; - private DateFormat xmlDf; + private final DateFormat xmlDf; /** * ExecuteFunction Constructor * - * @param context - * The Context of the calling XQuery + * @param context The Context of the calling XQuery. + * @param signature The signature of the function */ - public ExecuteFunction( XQueryContext context, FunctionSignature signature ) { - super( context, signature ); - xmlDf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS"); + public ExecuteFunction(final XQueryContext context, final FunctionSignature signature) { + super(context, signature); + this.xmlDf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS"); } @Override @@ -372,12 +393,13 @@ public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathExce } /** - * Release DB resources - * @param connection - * @param statement - * @param rs + * Release DB resources. + * + * @param connection the database connection. + * @param statement the query statement. + * @param rs the query results. */ - protected void release(Connection connection, Statement statement, ResultSet rs) { + protected void release(final Connection connection, final Statement statement, final ResultSet rs) { if (rs != null) { try { rs.close(); diff --git a/extensions/modules/sql-oracle/src/main/java/org/exist/xquery/modules/oracle/OracleModule.java b/extensions/modules/sql-oracle/src/main/java/org/exist/xquery/modules/oracle/OracleModule.java index d167a345eb..d4c3fdeb16 100644 --- a/extensions/modules/sql-oracle/src/main/java/org/exist/xquery/modules/oracle/OracleModule.java +++ b/extensions/modules/sql-oracle/src/main/java/org/exist/xquery/modules/oracle/OracleModule.java @@ -1,4 +1,28 @@ /* + * Elemental + * Copyright (C) 2024, Evolved Binary Ltd + * + * admin@evolvedbinary.com + * https://www.evolvedbinary.com | https://www.elemental.xyz + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; version 2.1. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * NOTE: Parts of this file contain code from 'The eXist-db Authors'. + * The original license header is included below. + * + * ===================================================================== + * * eXist-db Open Source Native XML Database * Copyright (C) 2001 The eXist-db Authors * @@ -27,9 +51,9 @@ import org.exist.xquery.FunctionDef; /** - * eXist Oracle Module Extension + * eXist-db Oracle Module Extension * - * An extension module for the eXist Native XML Database that allows execution of + * An extension module for the eXist-db Native XML Database that allows execution of * PL/SQL Stored Procedures within an Oracle RDBMS, returning an XML representation * of the result set. In particular, this module gives access to a ResultSet * returned in an OracleType.CURSOR, functionality which is not provided by @@ -40,23 +64,40 @@ * @author Robert Walpole * @serial 2010-03-23 * @version 1.0 - * - * @see org.exist.xquery.AbstractInternalModule#AbstractInternalModule(org.exist.xquery.FunctionDef[]) */ public class OracleModule extends AbstractInternalModule{ - + + /** + * Namespace URI for the OracleModule functions. + */ public final static String NAMESPACE_URI = "http://exist-db.org/xquery/oracle"; - + + /** + * Namespace prefix for the OracleModule functions. + */ public final static String PREFIX = "oracle"; + + /** + * Date that the OracleModule was added to eXist-db. + */ public final static String INCLUSION_DATE = "2010-03-23"; + + /** + * Version of eXist-db that first had the OracleModule. + */ public final static String RELEASED_IN_VERSION = "eXist-2.0"; private final static FunctionDef[] functions = { new FunctionDef(ExecuteFunction.signatures[0], ExecuteFunction.class), new FunctionDef(ExecuteFunction.signatures[1], ExecuteFunction.class) }; - - public OracleModule(Map> parameters) { + + /** + * Default Constructor. + * + * @param parameters parameters for configuring the module. + */ + public OracleModule(final Map> parameters) { super(functions, parameters); }