Uploaded image for project: 'Doctrine DBAL'
  1. Doctrine DBAL
  2. DBAL-914

the pdo_mysql driver do not always trhow an error when mysql does

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.4.2
    • Fix Version/s: None
    • Component/s: Drivers
    • Security Level: All
    • Labels:

      Description

      When a query get passed to mysql with the pdo_mysql driver and that the query end with a double semicolon "Create table test (test vachar(1));;". Mysql throw an error and stop the execution of the query there (aka in between the first and the second semicolon).
      That problem does not exist with the mysqli driver that correctly throw an error.

        Activity

        Hide
        ocramius Marco Pivetta added a comment -

        Doesn't look like a DBAL bug to me.

        As far as I know, PDO does not support multiple queries at all, while mysqli does.

        Show
        ocramius Marco Pivetta added a comment - Doesn't look like a DBAL bug to me. As far as I know, PDO does not support multiple queries at all, while mysqli does.
        Hide
        mikesimonson mikeSimonson added a comment -

        I suppose it does because if I insert a sql stmt, in between the two semicolon, it gets executed.

        I discovered that bug because I had one statement that created 20 tables or so and that someone edited it manually adding the second semicolon by mistake.
        And suddenly all that was after that double semicolon wasn't executed anymore.

        To be exact, I'd discover the bug using doctrine migration.
        I have made a little patch that you can use to test that case.
        For the test to run you will need to adapt the credential found in the Doctrine\DBAL\Migrations\Tests\MigrationTestCase file (after applying my patch).
        If you replace in that file pdo_mysql with mysqli the dirver correctly issue an error while the other does not.
        I have the impression that the root issue is that when mysql is given a statment with 2 semicolons at the end, it throws an error but with an empty errno.
        You can test that directly in mysql console.

        Thanks

        Show
        mikesimonson mikeSimonson added a comment - I suppose it does because if I insert a sql stmt, in between the two semicolon, it gets executed. I discovered that bug because I had one statement that created 20 tables or so and that someone edited it manually adding the second semicolon by mistake. And suddenly all that was after that double semicolon wasn't executed anymore. To be exact, I'd discover the bug using doctrine migration. I have made a little patch that you can use to test that case. For the test to run you will need to adapt the credential found in the Doctrine\DBAL\Migrations\Tests\MigrationTestCase file (after applying my patch). If you replace in that file pdo_mysql with mysqli the dirver correctly issue an error while the other does not. I have the impression that the root issue is that when mysql is given a statment with 2 semicolons at the end, it throws an error but with an empty errno. You can test that directly in mysql console. Thanks
        Show
        ocramius Marco Pivetta added a comment - See https://bugs.php.net/bug.php?id=61613
        Hide
        ocramius Marco Pivetta added a comment -

        Bug depends on a php-src bug

        Show
        ocramius Marco Pivetta added a comment - Bug depends on a php-src bug

          People

          • Assignee:
            ocramius Marco Pivetta
            Reporter:
            mikesimonson mikeSimonson
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: