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

Make it possible to addSql() that is executed as a statement #1326

Open
wants to merge 1 commit into
base: 3.6.x
Choose a base branch
from

Commits on Aug 16, 2023

  1. Make it possible to addSql() that is executed as a statement

    |      Q       |   A
    |------------- | -----------
    | Type         | improvement
    | BC Break     | no
    | Fixed issues | fixes doctrine#1325
    
     #### Summary
    
    When the DBAL connection uses `mysqli` as the driver, prepared statements are sent to the MySQL server through a dedicated protocol mechanism. For example, `CREATE TRIGGER` statements are not possible in this case.
    
    To use SQL statements like `CREATE TRIGGER`, the `DbalExecutor` may not (at least in the case of the `mysqli` driver) use `Connection::executeQuery()`, but has to call `Connection::executeStatement()`. See doctrine#1325 for more details.
    
    This PR adds a new `executeAsStatement` parameter to `\Doctrine\Migrations\AbstractMigration::addSql()`, which defaults to `false` (current behaviour). By setting it to true, a migration can pass the information to the `DbalExecutor` that the statement must be executed with `executeStatement()`, not `executeQuery()`.
    mpdude committed Aug 16, 2023
    Configuration menu
    Copy the full SHA
    607c2fa View commit details
    Browse the repository at this point in the history