Skip to content

Commit

Permalink
Merge pull request #138 from cainiaoDJ/master
Browse files Browse the repository at this point in the history
fix the exception(multi-statement not allow) when sql end with ';'
  • Loading branch information
isublimity committed Sep 29, 2020
2 parents 42bfb57 + 8fcb903 commit b10cd95
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Query/Query.php
Expand Up @@ -73,6 +73,11 @@ private function applyFormatQuery()
}
$supportFormats = implode("|",$this->supportFormats);

$this->sql = trim($this->sql);
if (substr($this->sql, -1) == ';') {
$this->sql = substr($this->sql, 0, -1);
}

$matches = [];
if (preg_match_all('%(' . $supportFormats . ')%ius', $this->sql, $matches)) {

Expand Down

0 comments on commit b10cd95

Please sign in to comment.