Skip to content

Commit

Permalink
fix: use binary type instead of byte.
Browse files Browse the repository at this point in the history
  • Loading branch information
ashigeru committed Jul 3, 2024
1 parent 0a31789 commit 450628e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
12 changes: 4 additions & 8 deletions src/mizugaki/parser/sql_parser.yy
Original file line number Diff line number Diff line change
Expand Up @@ -664,11 +664,8 @@
%token OWNED "OWNED"
%token PLACING "PLACING"
%token BYTE "BYTE"
%token BYTEVAR "BYTEVAR"
%token VARBIT "VARBIT"
%token VARBYTE "VARBYTE"
%token VARBINARY "VARBINARY"
%token TINYINT "TINYINT"
%token BIGINT "BIGINT"
Expand Down Expand Up @@ -3786,7 +3783,7 @@ data_type_system
$s,
@$);
}
| BYTE[k] parenthesized_size_opt[s]
| BINARY[k] parenthesized_size_opt[s]
{
$$ = driver.node<ast::type::octet_string>(
regioned { ast::type::kind::octet, @k },
Expand Down Expand Up @@ -3949,9 +3946,8 @@ bit_varying_type_name
;

octet_varying_type_name
: BYTE VARYING
| BYTEVAR
| VARBYTE
: BINARY VARYING
| VARBINARY
;

decimal_type_name
Expand Down
4 changes: 1 addition & 3 deletions src/mizugaki/parser/sql_scanner.ll
Original file line number Diff line number Diff line change
Expand Up @@ -422,10 +422,8 @@ host_parameter_name ":"{identifier}
"IF" { return parser_type::make_IF(location()); }
"INDEX" { return parser_type::make_INDEX(location()); }

"BYTE" { return parser_type::make_BYTE(location()); }
"BYTEVAR" { return parser_type::make_BYTEVAR(location()); }
"VARBIT" { return parser_type::make_VARBIT(location()); }
"VARBYTE" { return parser_type::make_VARBYTE(location()); }
"VARBINARY" { return parser_type::make_VARBINARY(location()); }

"PLACING" { return parser_type::make_PLACING(location()); }
"TINYINT" { return parser_type::make_TINYINT(location()); }
Expand Down
8 changes: 4 additions & 4 deletions test/mizugaki/parser/sql_parser_type_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ TEST_F(sql_parser_type_test, bit_varying_flexible) {
}

TEST_F(sql_parser_type_test, octet) {
auto result = parse("BYTE");
auto result = parse("BINARY");
ASSERT_TRUE(result) << diagnostics(result);

EXPECT_EQ(extract(result), (type::octet_string {
Expand All @@ -164,7 +164,7 @@ TEST_F(sql_parser_type_test, octet) {
}

TEST_F(sql_parser_type_test, octet_length) {
auto result = parse("BYTE(16)");
auto result = parse("BINARY(16)");
ASSERT_TRUE(result) << diagnostics(result);

EXPECT_EQ(extract(result), (type::octet_string {
Expand All @@ -174,7 +174,7 @@ TEST_F(sql_parser_type_test, octet_length) {
}

TEST_F(sql_parser_type_test, octet_varying) {
auto result = parse("BYTE VARYING(256)");
auto result = parse("BINARY VARYING(256)");
ASSERT_TRUE(result) << diagnostics(result);

EXPECT_EQ(extract(result), (type::octet_string {
Expand All @@ -184,7 +184,7 @@ TEST_F(sql_parser_type_test, octet_varying) {
}

TEST_F(sql_parser_type_test, octet_varying_flexible) {
auto result = parse("VARBYTE(*)");
auto result = parse("VARBINARY(*)");
ASSERT_TRUE(result) << diagnostics(result);

EXPECT_EQ(extract(result), (type::octet_string {
Expand Down

0 comments on commit 450628e

Please sign in to comment.