Skip to content

Commit

Permalink
feat: analyzer now can accept BLOB and CLOB types.
Browse files Browse the repository at this point in the history
  • Loading branch information
ashigeru committed Jan 23, 2025
1 parent 66e629a commit 402170b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/mizugaki/analyzer/details/analyze_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <takatori/type/date.h>
#include <takatori/type/time_of_day.h>
#include <takatori/type/time_point.h>
#include <takatori/type/lob.h>

#include <takatori/util/string_builder.h>

Expand Down Expand Up @@ -70,6 +71,10 @@ class engine {
return build(type, ttype::boolean {});
case k::date:
return build(type, ttype::date {});
case k::binary_large_object:
return build(type, ttype::blob {});
case k::character_large_object:
return build(type, ttype::clob {});
default:
break;
}
Expand Down
25 changes: 25 additions & 0 deletions test/mizugaki/analyzer/details/analyze_type_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <takatori/type/time_of_day.h>
#include <takatori/type/time_point.h>
#include <takatori/type/datetime_interval.h>
#include <takatori/type/lob.h>

#include <mizugaki/ast/type/simple.h>
#include <mizugaki/ast/type/character_string.h>
Expand Down Expand Up @@ -769,6 +770,30 @@ TEST_F(analyze_type_test, timestamp_timezone) {
EXPECT_EQ(*r, (ttype::time_point { ttype::with_time_zone }));
}

TEST_F(analyze_type_test, binary_large_object) {
auto r = analyze_type(
context(),
ast::type::simple {
ast::type::kind::binary_large_object,
});
ASSERT_TRUE(r) << diagnostics();
expect_no_error();

EXPECT_EQ(*r, (ttype::blob {}));
}

TEST_F(analyze_type_test, character_large_object) {
auto r = analyze_type(
context(),
ast::type::simple {
ast::type::kind::character_large_object,
});
ASSERT_TRUE(r) << diagnostics();
expect_no_error();

EXPECT_EQ(*r, (ttype::clob {}));
}

TEST_F(analyze_type_test, user_defined_unsupported) {
auto r = analyze_type(
context(),
Expand Down

0 comments on commit 402170b

Please sign in to comment.