Skip to content

Commit

Permalink
Only split on ; for TABLE related statements.
Browse files Browse the repository at this point in the history
Fixes #3142
  • Loading branch information
markstory committed Aug 24, 2012
1 parent c5ebbc9 commit dcc5a95
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Cake/Model/Datasource/DboSource.php
Expand Up @@ -447,7 +447,7 @@ public function execute($sql, $options = array(), $params = array()) {
*/
protected function _execute($sql, $params = array(), $prepareOptions = array()) {
$sql = trim($sql);
if (preg_match('/^(?:CREATE|ALTER|DROP)/i', $sql)) {
if (preg_match('/^(?:CREATE|ALTER|DROP)\s+TABLE/i', $sql)) {
$statements = array_filter(explode(';', $sql));
if (count($statements) > 1) {
$result = array_map(array($this, '_execute'), $statements);
Expand Down

3 comments on commit dcc5a95

@ceeram
Copy link
Contributor

@ceeram ceeram commented on dcc5a95 Aug 24, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

postgres did not like this change :(

@markstory
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Figures, I only ran tests for MySQL and SQLite :(

@markstory
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in b2f62f4

Please sign in to comment.