diff --git a/src/PHPSQLParser/processors/ColumnDefinitionProcessor.php b/src/PHPSQLParser/processors/ColumnDefinitionProcessor.php index 4cd162ae..d2d29e59 100644 --- a/src/PHPSQLParser/processors/ColumnDefinitionProcessor.php +++ b/src/PHPSQLParser/processors/ColumnDefinitionProcessor.php @@ -123,6 +123,7 @@ public function process($tokens) { break 2; case 'VARCHAR': + case 'VARCHARACTER': // Alias for VARCHAR $expr[] = array('expr_type' => ExpressionType::DATA_TYPE, 'base_expr' => $trim, 'length' => false); $prevCategory = 'TEXT'; $currCategory = 'SINGLE_PARAM_PARENTHESIS'; @@ -155,10 +156,15 @@ public function process($tokens) { case 'TINYBIT': case 'TINYINT': case 'SMALLINT': + case 'INT2': // Alias of SMALLINT case 'MEDIUMINT': + case 'INT3': // Alias of MEDIUMINT + case 'MIDDLEINT': // Alias of MEDIUMINT case 'INT': case 'INTEGER': + case 'INT4': // Alias of INT case 'BIGINT': + case 'INT8': // Alias of BIGINT case 'BOOL': case 'BOOLEAN': $expr[] = array('expr_type' => ExpressionType::DATA_TYPE, 'base_expr' => $trim, 'unsigned' => false, @@ -181,6 +187,7 @@ public function process($tokens) { continue 2; case 'CHAR': + case 'CHARACTER': // Alias for CHAR $expr[] = array('expr_type' => ExpressionType::DATA_TYPE, 'base_expr' => $trim, 'length' => false); $currCategory = 'SINGLE_PARAM_PARENTHESIS'; $prevCategory = 'TEXT'; @@ -188,7 +195,9 @@ public function process($tokens) { case 'REAL': case 'DOUBLE': + case 'FLOAT8': // Alias for DOUBLE case 'FLOAT': + case 'FLOAT4': // Alias for FLOAT $expr[] = array('expr_type' => ExpressionType::DATA_TYPE, 'base_expr' => $trim, 'unsigned' => false, 'zerofill' => false); $currCategory = 'TWO_PARAM_PARENTHESIS'; diff --git a/tests/cases/parser/issue355Test.php b/tests/cases/parser/issue355Test.php new file mode 100644 index 00000000..f2178a75 --- /dev/null +++ b/tests/cases/parser/issue355Test.php @@ -0,0 +1,35 @@ +parse($sql, true); + // We expect to see 10 parsed columns + $this->assertEquals( + 10, + count($parser->parsed['TABLE']['create-def']['sub_tree']) + ); + + } +} +