Skip to content

Improve Reporter hasOutput-Check #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 10, 2019
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,13 @@ public static OutputBuffer getCompatibleOutputBuffer(Version databaseVersion, Re

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

String sql = "select is_output_reporter from table(ut_runner.get_reporters_list) where regexp_like(reporter_object_name, ?)";
String sql = "select is_output_reporter " +
" from table(ut_runner.get_reporters_list)" +
" where ? = substr(reporter_object_name, length(reporter_object_name)-?+1)";
try ( PreparedStatement stmt = oraConn.prepareStatement(sql)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be much better to have a plsql seperate check for it.
The check could be:

begin
declare
   l_result boolean;
begin
   execute immediate '
   begin 
:x :=' || DBMS_ASSERT.SQL_OBJECT_NAME( ? ) || '() is of ut_output_reporter_base;
   end;'
using out l_result;
exception when others then null;
end;
? := l_result;
end;

stmt.setString(1, "[a-zA-Z0-9_]*\\.?" + reporter.getTypeName());
stmt.setQueryTimeout(3);
stmt.setString(1, reporter.getTypeName());
stmt.setInt(2, reporter.getTypeName().length());

try ( ResultSet rs = stmt.executeQuery() ) {
if ( rs.next() ) {
Expand Down