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

SQLite formatRandomInt should be enclosed in parenthesis #6

Open
SimonMellerin opened this issue Mar 8, 2024 · 0 comments
Open

SQLite formatRandomInt should be enclosed in parenthesis #6

SimonMellerin opened this issue Mar 8, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@SimonMellerin
Copy link
Member

actual version is

protected function formatRandomInt(RandomInt $expression, WriterContext $context): string
    {
        // ...
        return $this->formatRaw(
            new Raw(
                'abs(random()) % (? - ?) + ?',
                [$max, $min, $min]
            ),
            $context,
        );
    }

It could lead to unexpected behavior, see makinacorpus/DbToolsBundle#110 (comment)

@SimonMellerin SimonMellerin changed the title SQLite formatRandomInt should be enclosed in brackets SQLite formatRandomInt should be enclosed in parenthesis Mar 8, 2024
@pounard pounard added the enhancement New feature or request label Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants