Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #235 from dbould/fix-issue233
Fix for issue 233 comments not parsing when they have a quote
- Loading branch information
Showing
3 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace PHPSQLParser\Test\Parser; | ||
use PHPUnit_Framework_TestCase; | ||
use PHPSQLParser\PHPSQLParser; | ||
|
||
class issue233Test extends PHPUnit_Framework_TestCase | ||
{ | ||
public function testIssue233() | ||
{ | ||
$sql="#Check parser doesn't break with single quotes | ||
CREATE TABLE moomoo (cow VARCHAR(20));"; | ||
|
||
$parser = new PHPSQLParser($sql); | ||
|
||
$p = $parser->parsed; | ||
$expected = getExpectedValue(dirname(__FILE__), 'issue233.serialized'); | ||
$this->assertEquals($expected, $p, 'comment with single quote'); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
a:2:{s:6:"CREATE";a:4:{s:9:"expr_type";s:5:"table";s:10:"not-exists";b:0;s:9:"base_expr";s:5:"TABLE";s:8:"sub_tree";a:1:{i:0;a:2:{s:9:"expr_type";s:8:"reserved";s:9:"base_expr";s:5:"TABLE";}}}s:5:"TABLE";a:5:{s:9:"base_expr";s:6:"moomoo";s:4:"name";s:6:"moomoo";s:9:"no_quotes";a:2:{s:5:"delim";b:0;s:5:"parts";a:1:{i:0;s:6:"moomoo";}}s:10:"create-def";a:3:{s:9:"expr_type";s:18:"bracket_expression";s:9:"base_expr";s:18:" (cow VARCHAR(20))";s:8:"sub_tree";a:1:{i:0;a:3:{s:9:"expr_type";s:10:"column-def";s:9:"base_expr";s:15:"cow VARCHAR(20)";s:8:"sub_tree";a:2:{i:0;a:3:{s:9:"expr_type";s:6:"colref";s:9:"base_expr";s:3:"cow";s:9:"no_quotes";a:2:{s:5:"delim";b:0;s:5:"parts";a:1:{i:0;s:3:"cow";}}}i:1;a:7:{s:9:"expr_type";s:11:"column-type";s:9:"base_expr";s:11:"VARCHAR(20)";s:8:"sub_tree";a:2:{i:0;a:3:{s:9:"expr_type";s:9:"data-type";s:9:"base_expr";s:7:"VARCHAR";s:6:"length";s:2:"20";}i:1;a:3:{s:9:"expr_type";s:18:"bracket_expression";s:9:"base_expr";s:4:"(20)";s:8:"sub_tree";a:1:{i:0;a:2:{s:9:"expr_type";s:5:"const";s:9:"base_expr";s:2:"20";}}}}s:6:"unique";b:0;s:8:"nullable";b:1;s:8:"auto_inc";b:0;s:7:"primary";b:0;}}}}}s:7:"options";b:0;}} |