Skip to content

Fix SQLUtils.splitSqlScript: keep semicolons after END when semicolon is not the statement separator - #8108

Merged
eddumelendez merged 1 commit into
testcontainers:mainfrom
inponomarev:fix-sqlutils-for-oracle
Jan 15, 2024
Merged

Fix SQLUtils.splitSqlScript: keep semicolons after END when semicolon is not the statement separator#8108
eddumelendez merged 1 commit into
testcontainers:mainfrom
inponomarev:fix-sqlutils-for-oracle

Conversation

@inponomarev

Copy link
Copy Markdown
Contributor

This PR continues to stabilize ScriptUtils.splitSqlScript after major rework in #7646 and bug fixes in #7818

Problem

Currently in scripts for Oracle, where / is typically used as a statement separator, top-level BEGIN...END blocks are stripped from the semicolon. But unlike other databases, Oracle requires that semicolon is present, otherwise a syntax error occurs.

InputCurrent (incorrect) outputExpected output
BEGIN
  -- do something
END;
/
BEGIN
   -- do something else
END;
BEGIN
  -- do something
END

BEGIN
   -- do something else
END
BEGIN
  -- do something
END;

BEGIN
   -- do something else
END;

This behaviour occurs because of a misplaced line of code

This PR does not change the original behaviour of "recognizing" top-level BEGIN...END blocks when a specific statement separator is not set, i. e.

InputCurrent (correct) output
BEGIN
  -- do something
END;

BEGIN
   -- do something else
END;
BEGIN
  -- do something
END

BEGIN
   -- do something else
END

@inponomarev
inponomarev requested a review from a team January 12, 2024 13:00
@eddumelendez eddumelendez added this to the next milestone Jan 15, 2024
@eddumelendez
eddumelendez merged commit 4ff8d1d into testcontainers:main Jan 15, 2024
@eddumelendez

Copy link
Copy Markdown
Member

Thanks again for your contribution, @inponomarev !

fokion pushed a commit to fokion/testcontainers-java that referenced this pull request Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants