Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sqldev/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<!-- The Basics -->
<groupId>org.utplsql</groupId>
<artifactId>org.utplsql.sqldev</artifactId>
<version>1.0.0</version>
<version>1.1.0-SNAPSHOT</version>
<packaging>bundle</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
36 changes: 22 additions & 14 deletions sqldev/src/main/java/org/utplsql/sqldev/dal/UtplsqlDao.xtend
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import org.utplsql.sqldev.model.ut.OutputLines

class UtplsqlDao {
public static val UTPLSQL_PACKAGE_NAME = "UT"
public static val NOT_INSTALLED = 0000000
public static val FIRST_VERSION_WITH_INTERNAL_ANNOTATION_API = 3000004
public static val FIRST_VERSION_WITH_ANNOTATION_API = 3001003
public static val FIRST_VERSION_WITHOUT_INTERNAL_API = 3001008
Expand Down Expand Up @@ -60,14 +61,15 @@ class UtplsqlDao {
* returns a normalized utPLSQL version in format 9.9.9
*/
def String normalizedUtPlsqlVersion() {
val p = Pattern.compile("(\\d+\\.\\d+\\.\\d+)")
val version = getUtPlsqlVersion()
val m = p.matcher(version)
if (m.find) {
return m.group(0)
} else {
return "0.0.0"
if (version !== null) {
val p = Pattern.compile("(\\d+\\.\\d+\\.\\d+)")
val m = p.matcher(version)
if (m.find) {
return m.group(0)
}
}
return "0.0.0"
}

/**
Expand Down Expand Up @@ -97,14 +99,20 @@ class UtplsqlDao {
? := ut.version;
END;
'''
cachedUtPlsqlVersion = jdbcTemplate.execute(sql, new CallableStatementCallback<String>() {
override String doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException {
cs.registerOutParameter(1, Types.VARCHAR);
cs.execute
val version = cs.getString(1)
return version
}
})
try {
cachedUtPlsqlVersion = jdbcTemplate.execute(sql, new CallableStatementCallback<String>() {
override String doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException {
cs.registerOutParameter(1, Types.VARCHAR);
cs.execute
val version = cs.getString(1)
return version
}
})
} catch (SQLException e) {
// ignore error
} catch (DataAccessException e) {
// ignore error
}
}
return cachedUtPlsqlVersion
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -588,5 +588,12 @@ class DalTest extends AbstractJdbcTest {
Assert.assertEquals("PACKAGE", actual)
jdbcTemplate.execute("DROP PACKAGE junit_utplsql_test_pkg")
}

@Test
def void normalizedUtPlsqlVersion() {
val dao = new UtplsqlDao(dataSource.connection)
val version = dao.normalizedUtPlsqlVersion
Assert.assertTrue(version !== null)
}

}