Skip to content
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

suppress force_print text #51

Open
nmaqsudov opened this issue Feb 1, 2024 · 0 comments
Open

suppress force_print text #51

nmaqsudov opened this issue Feb 1, 2024 · 0 comments

Comments

@nmaqsudov
Copy link

nmaqsudov commented Feb 1, 2024

https://github.com/oracle/oracle-db-tools/blob/0ba494dc82cbb555235d15f1a2b08b2508aefd92/sqlcl/java/src/RunMyScript.java#L44C5-L44C56

We should not patch the result of execution by deleting some text because we don't know if this a real text generated by script or an artefact of ScriptRunnerContext class. To suppress the force_print text at the and of each command execution report it is much better to do the following:

ctx.putProperty('script.runner.using.systemout', True)

I propose to add this line just after creation of context

		    ScriptRunnerContext ctx = new ScriptRunnerContext();
		    ctx.setBaseConnection(conn);
                    ctx.putProperty('script.runner.using.systemout', Boolean.TRUE);  /// <--- here

and remove line

results = results.replaceAll(" force_print\n", "");

This change should be applied to both sqlcl/java/src/ParseScriptRunOneAtATime.java and sqlcl/java/src/RunMyScript.java examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant