feat(plugin-oracle): show DBMS_OUTPUT with the result of the statement that printed it - #2990
Merged
Merged
Conversation
…t that printed it
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #2988 (#2984). With PL/SQL blocks running, the block from the issue ran and showed nothing, because
DBMS_OUTPUT.PUT_LINEwrites to a session buffer only a client that asks ever reads.What it does
DBMS_OUTPUTfor every session at connect, and again after a reconnect, since the setting belongs to the session. NoSET SERVEROUTPUT ONneeded.How the lines are read
One round trip: a fixed PL/SQL block calls
SYS.DBMS_OUTPUT.GET_LINES, splits every line into pieces a SQLVARCHAR2can hold, and returns them through a REF CURSOR, which the core joins back together.The split has to happen in PL/SQL. Measured on Oracle 23ai (
MAX_STRING_SIZE=STANDARD): aDBMS_OUTPUTline can be 32767 bytes, any SQL over a longer-than-4000-byte element fails with ORA-00910 even throughSUBSTR, and oracle-nio does not throw that error: a failure while the block opens its cursor ends the process in afatalErrorinside the driver. Reading the lines asSYS.ODCIVARCHAR2LISTpieces of at most 999 characters keeps every SQL value under 4000 bytes in any character set.Every package and type in the enable call and the drain block is named with its owner (
SYS.DBMS_OUTPUT,SYS.DBMSOUTPUT_LINESARRAY,SYS.ODCIVARCHAR2LIST). A bareDBMS_OUTPUTresolves to an object of that name in the session's current schema before the public synonym. Measured on 23ai: with aDBMS_OUTPUTpackage created in the connecting user's schema, the bare-name version called that package'sENABLEandGET_LINESand the real line was never read; with owner-qualified names the same package received no calls and the line came back. Schema functions namedSUBSTR,LENGTH,NVLandLEASTdid not shadow the builtins the block uses. A unit test fails if any of the three names appears withoutSYS..Measured through
OracleCoreConnectionagainst 23ai:API
PluginDatabaseDriver.fetchServerOutput()with an empty default and aPluginServerOutputtransfer struct: additive, verified withscripts/check-pluginkit-abi.shagainst the merge base (no symbol removed), reusing the unreleased kit 33 (v0.75.0 shipped 32), so no bump. Every other driver returns nothing without a round trip.Also carries the catalog entries for #2988's two compilation-error strings, whose follow-up commit reached the branch after it merged.
Known limit
Lines a trigger prints while a grid edit is saved are not read at save time and show with the next statement run from the editor. The docs say so. Reading them there would mean threading the capture through the change-save path, which reports no result to attach them to.
Tests
OracleServerOutputTests(package): piece reassembly, empty lines, truncation, the 4000-byte bound, owner-qualified names, bind order.ServerOutputCaptureTests: output attached on success, read on failure for the error, nothing sent after a cancel, the bounded failure message.TabDisplayOutputModeTests: Output mode leaves when the next result printed nothing.QueryResultPresentationTests,ResultsModeAvailabilityTests,GridSelectionOwnerTests: the Output mode and the success view's output.No UI automation: CI has no Oracle server to print anything.