Skip to content

Commit a4ee67d

Browse files
committed
Change hasOutput-Query to not use Regexp. Added Statement Timeout
There might be a problem of pipelined functions limited by regexp_like in 11g we can probably avoid with a different approach. Additionally, setting a Statement-Timeout here will prevent the cli to wait forever in case of an error.
1 parent c05b257 commit a4ee67d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/java/org/utplsql/api/outputBuffer/OutputBufferProvider.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,13 @@ public static OutputBuffer getCompatibleOutputBuffer(Version databaseVersion, Re
4242

4343
private static boolean hasOutput( Reporter reporter, OracleConnection oraConn ) throws SQLException {
4444

45-
String sql = "select is_output_reporter from table(ut_runner.get_reporters_list) where regexp_like(reporter_object_name, ?)";
45+
String sql = "select is_output_reporter " +
46+
" from table(ut_runner.get_reporters_list)" +
47+
" where ? = substr(reporter_object_name, length(reporter_object_name)-?+1)";
4648
try ( PreparedStatement stmt = oraConn.prepareStatement(sql)) {
47-
stmt.setString(1, "[a-zA-Z0-9_]*\\.?" + reporter.getTypeName());
49+
stmt.setQueryTimeout(3);
50+
stmt.setString(1, reporter.getTypeName());
51+
stmt.setInt(2, reporter.getTypeName().length());
4852

4953
try ( ResultSet rs = stmt.executeQuery() ) {
5054
if ( rs.next() ) {

0 commit comments

Comments
 (0)