Skip to content

Commit

Permalink
added wstring stuff needed for building with merged master branch
Browse files Browse the repository at this point in the history
  • Loading branch information
bold84 committed Apr 1, 2024
1 parent 1aa9410 commit d1e7608
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions include/soci/type-holder.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ struct soci_cast<
union type_holder
{
std::string* s;
std::wstring* ws;
int8_t* i8;
int16_t* i16;
int32_t* i32;
Expand All @@ -153,6 +154,12 @@ struct type_holder_trait<std::string>
static const db_type type = db_string;
};

template <>
struct type_holder_trait<std::wstring>
{
static const db_type type = db_wstring;
};

template <>
struct type_holder_trait<int8_t>
{
Expand Down Expand Up @@ -304,6 +311,8 @@ class holder
case db_xml:
case db_string:
delete val_.s;
case db_wstring:
delete val_.ws;
break;
}
}
Expand Down Expand Up @@ -345,6 +354,8 @@ class holder
case db_xml:
case db_string:
return soci_cast<T, std::string>::cast(*val_.s);
case db_wstring:
return soci_cast<T, std::wstring>::cast(*val_.ws);
}

throw std::bad_cast();
Expand Down Expand Up @@ -380,6 +391,8 @@ class holder
case db_xml:
case db_string:
return soci_return_same<T, std::string>::value(*val_.s);
case db_wstring:
return soci_return_same<T, std::wstring>::value(*val_.ws);
}

throw std::bad_cast();
Expand Down Expand Up @@ -430,6 +443,9 @@ class holder
case db_string:
val_.s = static_cast<std::string*>(val);
return;
case db_wstring:
val_.ws = static_cast<std::wstring*>(val);
return;
}

// This should be unreachable
Expand Down

0 comments on commit d1e7608

Please sign in to comment.