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 a9f7996
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 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 @@ -305,6 +312,9 @@ class holder
case db_string:
delete val_.s;
break;
case db_wstring:
delete val_.ws;
break;
}
}

Expand Down Expand Up @@ -345,6 +355,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 +392,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 +444,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 a9f7996

Please sign in to comment.