Skip to content

Commit 9e523ce

Browse files
authored
Merge pull request #166 from evolvedbinary/6.x.x/feature/enable-ojdbc
[6.x.x] Enable sql-oracle module by default
2 parents 43c2ddc + b231fb0 commit 9e523ce

4 files changed

Lines changed: 94 additions & 37 deletions

File tree

extensions/modules/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
<module>scheduler</module>
8888
<module>simpleql</module>
8989
<module>sql</module>
90-
<!-- module>sql-oracle</module --> <!-- Requires registration with Oracle! -->
90+
<module>sql-oracle</module>
9191
<module>xmldiff</module>
9292
<module>xslfo</module>
9393
</modules>

extensions/modules/sql-oracle/pom.xml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
</multi>
102102
<includes>
103103
<include>pom.xml</include>
104+
<include>src/main/java/**</include>
104105
</includes>
105106
</licenseSet>
106107

@@ -111,6 +112,7 @@
111112
<header>${project.parent.relativePath}/../../exist-parent/existdb-LGPL-21-license.template.txt</header>
112113
<excludes>
113114
<exclude>pom.xml</exclude>
115+
<exclude>src/main/java/**</exclude>
114116
</excludes>
115117
</licenseSet>
116118

@@ -131,6 +133,11 @@
131133
<artifactId>exist-core</artifactId>
132134
<version>${project.version}</version>
133135
</dependency>
136+
<dependency>
137+
<groupId>xyz.elemental.fork.org.exist-db</groupId>
138+
<artifactId>exist-sql</artifactId>
139+
<version>${project.version}</version>
140+
</dependency>
134141

135142
<dependency>
136143
<groupId>com.oracle.database.jdbc</groupId>
@@ -145,17 +152,4 @@
145152

146153
</dependencies>
147154

148-
<repositories>
149-
<repository>
150-
<id>maven.oracle.com</id>
151-
<name>oracle-maven-repo</name>
152-
<url>https://maven.oracle.com</url>
153-
<layout>default</layout>
154-
<releases>
155-
<enabled>true</enabled>
156-
<updatePolicy>always</updatePolicy>
157-
</releases>
158-
</repository>
159-
</repositories>
160-
161155
</project>

extensions/modules/sql-oracle/src/main/java/org/exist/xquery/modules/oracle/ExecuteFunction.java

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
11
/*
2+
* Elemental
3+
* Copyright (C) 2024, Evolved Binary Ltd
4+
*
5+
* admin@evolvedbinary.com
6+
* https://www.evolvedbinary.com | https://www.elemental.xyz
7+
*
8+
* This library is free software; you can redistribute it and/or
9+
* modify it under the terms of the GNU Lesser General Public
10+
* License as published by the Free Software Foundation; version 2.1.
11+
*
12+
* This library is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
* Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public
18+
* License along with this library; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20+
*
21+
* NOTE: Parts of this file contain code from 'The eXist-db Authors'.
22+
* The original license header is included below.
23+
*
24+
* =====================================================================
25+
*
226
* eXist-db Open Source Native XML Database
327
* Copyright (C) 2001 The eXist-db Authors
428
*
@@ -65,16 +89,13 @@
6589
import org.w3c.dom.NodeList;
6690

6791
/**
68-
* eXist Oracle Module Extension ExecuteFunction
92+
* eXist-db Oracle Module Extension ExecuteFunction
6993
*
7094
* Execute a PL/SQL stored procedure within an Oracle RDBMS.
7195
*
7296
* @author <a href="mailto:robert.walpole@metoffice.gov.uk">Robert Walpole</a>
7397
* @serial 2009-03-23
7498
* @version 1.0
75-
*
76-
* @see org.exist.xquery.BasicFunction#BasicFunction(org.exist.xquery.XQueryContext,
77-
* org.exist.xquery.FunctionSignature)
7899
*/
79100
public class ExecuteFunction extends BasicFunction {
80101

@@ -124,17 +145,17 @@ public class ExecuteFunction extends BasicFunction {
124145
private final static String TYPE_ATTRIBUTE_NAME = "type";
125146
private final static String POSITION_ATTRIBUTE_NAME = "pos";
126147

127-
private DateFormat xmlDf;
148+
private final DateFormat xmlDf;
128149

129150
/**
130151
* ExecuteFunction Constructor
131152
*
132-
* @param context
133-
* The Context of the calling XQuery
153+
* @param context The Context of the calling XQuery.
154+
* @param signature The signature of the function
134155
*/
135-
public ExecuteFunction( XQueryContext context, FunctionSignature signature ) {
136-
super( context, signature );
137-
xmlDf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
156+
public ExecuteFunction(final XQueryContext context, final FunctionSignature signature) {
157+
super(context, signature);
158+
this.xmlDf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
138159
}
139160

140161
@Override
@@ -372,12 +393,13 @@ public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathExce
372393
}
373394

374395
/**
375-
* Release DB resources
376-
* @param connection
377-
* @param statement
378-
* @param rs
396+
* Release DB resources.
397+
*
398+
* @param connection the database connection.
399+
* @param statement the query statement.
400+
* @param rs the query results.
379401
*/
380-
protected void release(Connection connection, Statement statement, ResultSet rs) {
402+
protected void release(final Connection connection, final Statement statement, final ResultSet rs) {
381403
if (rs != null) {
382404
try {
383405
rs.close();

extensions/modules/sql-oracle/src/main/java/org/exist/xquery/modules/oracle/OracleModule.java

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
11
/*
2+
* Elemental
3+
* Copyright (C) 2024, Evolved Binary Ltd
4+
*
5+
* admin@evolvedbinary.com
6+
* https://www.evolvedbinary.com | https://www.elemental.xyz
7+
*
8+
* This library is free software; you can redistribute it and/or
9+
* modify it under the terms of the GNU Lesser General Public
10+
* License as published by the Free Software Foundation; version 2.1.
11+
*
12+
* This library is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
* Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public
18+
* License along with this library; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20+
*
21+
* NOTE: Parts of this file contain code from 'The eXist-db Authors'.
22+
* The original license header is included below.
23+
*
24+
* =====================================================================
25+
*
226
* eXist-db Open Source Native XML Database
327
* Copyright (C) 2001 The eXist-db Authors
428
*
@@ -27,9 +51,9 @@
2751
import org.exist.xquery.FunctionDef;
2852

2953
/**
30-
* eXist Oracle Module Extension
54+
* eXist-db Oracle Module Extension
3155
*
32-
* An extension module for the eXist Native XML Database that allows execution of
56+
* An extension module for the eXist-db Native XML Database that allows execution of
3357
* PL/SQL Stored Procedures within an Oracle RDBMS, returning an XML representation
3458
* of the result set. In particular, this module gives access to a <code>ResultSet</code>
3559
* returned in an <code>OracleType.CURSOR</code>, functionality which is not provided by
@@ -40,23 +64,40 @@
4064
* @author <a href="mailto:robert.walpole@metoffice.gov.uk">Robert Walpole</a>
4165
* @serial 2010-03-23
4266
* @version 1.0
43-
*
44-
* @see org.exist.xquery.AbstractInternalModule#AbstractInternalModule(org.exist.xquery.FunctionDef[])
4567
*/
4668
public class OracleModule extends AbstractInternalModule{
47-
69+
70+
/**
71+
* Namespace URI for the OracleModule functions.
72+
*/
4873
public final static String NAMESPACE_URI = "http://exist-db.org/xquery/oracle";
49-
74+
75+
/**
76+
* Namespace prefix for the OracleModule functions.
77+
*/
5078
public final static String PREFIX = "oracle";
79+
80+
/**
81+
* Date that the OracleModule was added to eXist-db.
82+
*/
5183
public final static String INCLUSION_DATE = "2010-03-23";
84+
85+
/**
86+
* Version of eXist-db that first had the OracleModule.
87+
*/
5288
public final static String RELEASED_IN_VERSION = "eXist-2.0";
5389

5490
private final static FunctionDef[] functions = {
5591
new FunctionDef(ExecuteFunction.signatures[0], ExecuteFunction.class),
5692
new FunctionDef(ExecuteFunction.signatures[1], ExecuteFunction.class)
5793
};
58-
59-
public OracleModule(Map<String, List<? extends Object>> parameters) {
94+
95+
/**
96+
* Default Constructor.
97+
*
98+
* @param parameters parameters for configuring the module.
99+
*/
100+
public OracleModule(final Map<String, List<? extends Object>> parameters) {
60101
super(functions, parameters);
61102
}
62103

0 commit comments

Comments
 (0)