Skip to content

Commit 23d3dae

Browse files
author
Samuel Nitsche
committed
Merge remote-tracking branch 'upstream/develop' into feature/version_check
2 parents c4c6e08 + f930370 commit 23d3dae

File tree

3 files changed

+26
-19
lines changed

3 files changed

+26
-19
lines changed

pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
<version>12.2.0.1</version>
2424
<scope>compile</scope>
2525
</dependency>
26+
<dependency>
27+
<groupId>com.oracle.jdbc</groupId>
28+
<artifactId>orai18n</artifactId>
29+
<version>12.2.0.1</version>
30+
<scope>compile</scope>
31+
</dependency>
2632
<dependency>
2733
<groupId>junit</groupId>
2834
<artifactId>junit</artifactId>

src/main/java/org/utplsql/api/DBHelper.java

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*/
1313
public final class DBHelper {
1414

15-
public static final String UTPLSQL_COMPATIBILITY_VERSION = "3.0.3";
15+
public static final String UTPLSQL_COMPATIBILITY_VERSION = "3";
1616

1717
private DBHelper() {}
1818

@@ -96,6 +96,24 @@ public static boolean versionCompatibilityCheck(Connection conn)
9696
return versionCompatibilityCheck(conn, UTPLSQL_COMPATIBILITY_VERSION);
9797
}
9898

99+
100+
/** Checks if actual API-version is compatible with utPLSQL database version and throws a RuntimeException if not
101+
* Throws a RuntimeException if version compatibility can not be checked.
102+
*
103+
* @param conn Active db connection
104+
*/
105+
public static void failOnVersionCompatibilityCheckFailed( Connection conn )
106+
{
107+
try {
108+
if (!versionCompatibilityCheck(conn))
109+
throw new RuntimeException("API-Version " + UTPLSQL_COMPATIBILITY_VERSION + " not compatible with database. Aborting.");
110+
}
111+
catch ( SQLException e )
112+
{
113+
throw new RuntimeException("Compatibility-check failed with error. Aborting.", e);
114+
}
115+
}
116+
99117
/**
100118
* Enable the dbms_output buffer with unlimited size.
101119
* @param conn the connection
@@ -119,21 +137,4 @@ public static void disableDBMSOutput(Connection conn) {
119137
System.out.println("Failed to disable dbms_output.");
120138
}
121139
}
122-
123-
/** Checks if actual API-version is compatible with utPLSQL database version and throws a RuntimeException if not
124-
* Throws a RuntimeException if version compatibility can not be checked.
125-
*
126-
* @param conn
127-
*/
128-
public static void failOnVersionCompatibilityCheckFailed( Connection conn )
129-
{
130-
try {
131-
if (!versionCompatibilityCheck(conn))
132-
throw new RuntimeException("API-Version " + UTPLSQL_VERSION + " not compatible with database. Aborting.");
133-
}
134-
catch ( SQLException e )
135-
{
136-
throw new RuntimeException("Compatibility-check failed with error. Aborting.", e);
137-
}
138-
}
139140
}

src/main/java/org/utplsql/api/exception/DatabaseNotCompatibleException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public DatabaseNotCompatibleException( String clientVersion, String databaseVers
3232

3333
public DatabaseNotCompatibleException( String databaseVersion, Throwable cause )
3434
{
35-
this(DBHelper.UTPLSQL_VERSION, databaseVersion, cause );
35+
this(DBHelper.UTPLSQL_COMPATIBILITY_VERSION, databaseVersion, cause );
3636
}
3737

3838
public String getClientVersion() {

0 commit comments

Comments
 (0)