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

Strange delimiter behavior parsing the file in the wrong area #7

Open
markoueis opened this issue Jul 19, 2024 · 2 comments
Open

Strange delimiter behavior parsing the file in the wrong area #7

markoueis opened this issue Jul 19, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@markoueis
Copy link

The default oracle delimiter for multiple statements is /
However this should obviously not cause the file to split on / if the / is used in some sort of math division. I'm seeing it incorrectly parse a large file at this line here

l_amount := mv_round_amount(l_amount_to_dist*(l_pct/100),trans_rec.currency_id);

What's going on here? This seems so basic that I feel I must be doing something wrong, but this is indeed what is happening.

It doesn't seem to parse on / if the / is in comments or in strings. What's going on here? How can i move forward.

From what i can tell the parsing logic is implemented in dbup and not in dbup.oracle which is why i'm posting this here.

@markoueis markoueis added the bug Something isn't working label Jul 19, 2024
@droyad droyad transferred this issue from DbUp/DbUp Jul 19, 2024
@markoueis
Copy link
Author

To simplify it, this test fails

[Fact]
public void CanParseMultilineScript()
{
var multiCommand = "create table FOO (myid INT NOT NULL)/";
multiCommand += Environment.NewLine;
multiCommand += "create table BAR (myid INT NOT NULL, myNum INT NOT NULL DEFAULT**(10/2)**)";

   var connectionManager = new OracleConnectionManager("connectionstring", new OracleCommandSplitter('/'));
   var result = connectionManager.SplitScriptIntoCommands(multiCommand);

   result.Count().ShouldBe(2);

}

@Orkad
Copy link

Orkad commented Oct 27, 2024

Same problem for trigger creation with ";" the only thing you can do is to use the custom keyword DELIMITER ; before the division to change the current SQL command delimiter in the file. I'm sure the SQL splitting behavior could be improved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants