Skip to content

Commit

Permalink
accept int_ type for decimal column value
Browse files Browse the repository at this point in the history
  • Loading branch information
t-horikawa committed Jan 12, 2024
1 parent 88b36f4 commit db074e3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/ogawayama/stub/result_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,16 @@ ErrorCode ResultSet::Impl::next_column(takatori::decimal::triple& value) {
case jogasaki::serializer::entry_type::decimal:
value = jogasaki::serializer::read_decimal(iter_, buf_.end());
return ErrorCode::OK;
case jogasaki::serializer::entry_type::int_:
{
auto coefficient = jogasaki::serializer::read_int(iter_, buf_.end());
if (coefficient >= 0) {
value = takatori::decimal::triple{1, 0, static_cast<std::uint64_t>(coefficient) , 0};
} else {
value = takatori::decimal::triple{-1, 0, static_cast<std::uint64_t>(-coefficient) , 0};
}
return ErrorCode::OK;
}
default:
std::cerr << "error: decimal expected, actually " << jogasaki::serializer::to_string_view(entry_type) << " received" << std::endl;
return ErrorCode::COLUMN_TYPE_MISMATCH;
Expand Down

0 comments on commit db074e3

Please sign in to comment.