Skip to content

Commit

Permalink
Updated Oracle dialect.
Browse files Browse the repository at this point in the history
  • Loading branch information
rma-rripken committed Dec 29, 2023
1 parent 6fe5fff commit 8e5469c
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions cwms-data-api/src/main/java/cwms/cda/data/dao/Dao.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import usace.cwms.db.dao.util.services.CwmsDbServiceLookup;
import usace.cwms.db.jooq.codegen.packages.CWMS_ENV_PACKAGE;

import static usace.cwms.db.jooq.codegen.tables.AV_DB_CHANGE_LOG.AV_DB_CHANGE_LOG;;
import static usace.cwms.db.jooq.codegen.tables.AV_DB_CHANGE_LOG.AV_DB_CHANGE_LOG;

public abstract class Dao<T> {
public static final int CWMS_18_1_8 = 180108;
Expand All @@ -28,13 +28,13 @@ public abstract class Dao<T> {
public Dao(DSLContext dsl) {
this.dsl = dsl;
String version = dsl.connectionResult(c-> {
return DSL.using(c,SQLDialect.ORACLE11G).select(AV_DB_CHANGE_LOG.VERSION)
return DSL.using(c,SQLDialect.ORACLE18C).select(AV_DB_CHANGE_LOG.VERSION)
.from(AV_DB_CHANGE_LOG)
.orderBy(AV_DB_CHANGE_LOG.VERSION_DATE.desc())
.limit(1)
.fetchOne().component1();
});
String parts[] = version.split("\\.");
String[] parts = version.split("\\.");
cwmsDbVersion =
Integer.parseInt(parts[0])*10000
+Integer.parseInt(parts[1])*100
Expand Down
4 changes: 2 additions & 2 deletions cwms-data-api/src/main/java/cwms/cda/data/dao/JooqDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public static DSLContext getDslContext(Context ctx) {
if (dataSource != null) {
DataSource wrappedDataSource = new ConnectionPreparingDataSource(connection ->
setClientInfo(ctx, connection), dataSource);
retVal = DSL.using(wrappedDataSource, SQLDialect.ORACLE11G);
retVal = DSL.using(wrappedDataSource, SQLDialect.ORACLE18C);
} else {
// Some tests still use this method
logger.atFine().withStackTrace(StackSize.FULL)
Expand Down Expand Up @@ -119,7 +119,7 @@ private static Connection setClientInfo(Context ctx, Connection connection) {
}

public static DSLContext getDslContext(Connection database, String officeId) {
DSLContext dsl = DSL.using(database, SQLDialect.ORACLE11G);
DSLContext dsl = DSL.using(database, SQLDialect.ORACLE18C);
CWMS_ENV_PACKAGE.call_SET_SESSION_OFFICE_ID(dsl.configuration(), officeId);

return dsl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public Connection acquire() throws DataAccessException {

public static Connection getConnection(Connection conn, String office) {
try {
DSLContext dsl = DSL.using(conn, SQLDialect.ORACLE11G);
DSLContext dsl = DSL.using(conn, SQLDialect.ORACLE18C);
CWMS_ENV_PACKAGE.call_SET_SESSION_OFFICE_ID(dsl.configuration(), office);
} catch (Exception e) {
throw new DataAccessException("Unable to set session office id to " + office, e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public SessionOfficePreparer(String office) {
public Connection prepare(Connection conn) {

if(office != null && !office.isEmpty()) {
DSLContext dsl = DSL.using(conn, SQLDialect.ORACLE11G);
DSLContext dsl = DSL.using(conn, SQLDialect.ORACLE18C);
try {
logger.fine("Setting office to: " + office);
CWMS_ENV_PACKAGE.call_SET_SESSION_OFFICE_ID(dsl.configuration(), office);
Expand Down
4 changes: 2 additions & 2 deletions cwms-data-api/src/test/java/cwms/cda/api/DataApiTestIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ protected static void removeUserFromGroup(String user, String group, String offi
* Get context, setting a specific session office.
*/
protected static DSLContext dslContext(Connection connection, String officeId) {
DSLContext dsl = DSL.using(connection, SQLDialect.ORACLE11G);
DSLContext dsl = DSL.using(connection, SQLDialect.ORACLE18C);
CWMS_ENV_PACKAGE.call_SET_SESSION_OFFICE_ID(dsl.configuration(), officeId);
return dsl;
}
Expand All @@ -377,7 +377,7 @@ protected static DSLContext dslContext(Connection connection, String officeId) {
* Get context without setting office
*/
protected static DSLContext dslContext(Connection connection) {
DSLContext dsl = DSL.using(connection, SQLDialect.ORACLE11G);
DSLContext dsl = DSL.using(connection, SQLDialect.ORACLE18C);
return dsl;
}

Expand Down
4 changes: 2 additions & 2 deletions cwms-data-api/src/test/java/cwms/cda/data/dao/DaoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static Connection getConnection() throws SQLException

public static DSLContext getDslContext(Connection database, String officeId)
{
DSLContext dsl = DSL.using(database, SQLDialect.ORACLE11G);
DSLContext dsl = DSL.using(database, SQLDialect.ORACLE18C);
CWMS_ENV_PACKAGE.call_SET_SESSION_OFFICE_ID(dsl.configuration(), officeId);
return dsl;
}
Expand All @@ -63,7 +63,7 @@ public static DSLContext getDslContext(String officeId) throws SQLException {
DataSource ds = new org.apache.tomcat.jdbc.pool.DataSource(poolProperties);

ConnectionProvider cp = new OfficeSettingConnectionProvider(ds, officeId);
DSLContext dsl = DSL.using(cp, SQLDialect.ORACLE11G);
DSLContext dsl = DSL.using(cp, SQLDialect.ORACLE18C);
dsl.configuration().set(new DefaultExecuteListenerProvider(JooqDao.listener));
return dsl;
}
Expand Down
2 changes: 1 addition & 1 deletion cwms-data-api/src/test/java/fixtures/TestJooqMock.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class TestJooqMock {

@Test
public void test_json_mock_result() throws Exception {
DSLContext dsl = DSL.using(SQLDialect.ORACLE12C);
DSLContext dsl = DSL.using(SQLDialect.ORACLE18C);
InputStream is = TestJooqMock.class.getResourceAsStream("/mock_location_test.json");
Scanner scanner = new Scanner(is);
String contents = scanner.useDelimiter("\\A").next();
Expand Down

0 comments on commit 8e5469c

Please sign in to comment.