SQL dump silently fails if query is not terminated by semicolon #4059

Closed
igorsantos07 opened this Issue Mar 14, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@igorsantos07
Contributor

igorsantos07 commented Mar 14, 2017

What are you trying to achieve?

Importing a dump that includes a single INSERT statement, not terminated by semicolon - it's expected to run just fine on PDO; in the end, it's a single command.

What do you get instead?

Nothing. Pure wind.

Investigation

Investigating the issue, it seems related to a silent test done by Driver\Db, which basically doesn't run queries not terminated by the given delimiter.

To me, this feels like a not needed protection that might have bad, silent side effects - like it happened to me. So I would expect one of those:

  1. some reason on why this is needed since the underlying driver (PDO) is completely capable of running SQL queries without a delimiter in the very end. I noticed this is cited as needed in the Db Module doc, but without reasoning.
  2. that guard to be taken out, so queries can run freely without a delimiter :)

Details

  • Codeception version: ^2.2 (dev-master, c8df4d7)
  • PHP Version: 7.0.x
  • Operating System: Ubuntu
  • Installation type: Composer

Naktibalda added a commit to Naktibalda/Codeception that referenced this issue Mar 22, 2017

@DavertMik DavertMik closed this in #4071 Mar 24, 2017

DavertMik added a commit that referenced this issue Mar 24, 2017

Fixed Issue/4059 (#4071)
* [Db] Run the last statement in file even if it doesn't end with delimiter

Fixes #4059

* Eliminated property sqltoRun

chris1312 added a commit to chris1312/Codeception that referenced this issue Jun 16, 2017

Fixed Issue/4059 (#4071)
* [Db] Run the last statement in file even if it doesn't end with delimiter

Fixes #4059

* Eliminated property sqltoRun
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment