diff --git a/include/soci/type-holder.h b/include/soci/type-holder.h index 73badaa14..f8f9906b5 100644 --- a/include/soci/type-holder.h +++ b/include/soci/type-holder.h @@ -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; @@ -153,6 +154,12 @@ struct type_holder_trait static const db_type type = db_string; }; +template <> +struct type_holder_trait +{ + static const db_type type = db_wstring; +}; + template <> struct type_holder_trait { @@ -304,6 +311,8 @@ class holder case db_xml: case db_string: delete val_.s; + case db_wstring: + delete val_.ws; break; } } @@ -345,6 +354,8 @@ class holder case db_xml: case db_string: return soci_cast::cast(*val_.s); + case db_wstring: + return soci_cast::cast(*val_.ws); } throw std::bad_cast(); @@ -380,6 +391,8 @@ class holder case db_xml: case db_string: return soci_return_same::value(*val_.s); + case db_wstring: + return soci_return_same::value(*val_.ws); } throw std::bad_cast(); @@ -430,6 +443,9 @@ class holder case db_string: val_.s = static_cast(val); return; + case db_wstring: + val_.ws = static_cast(val); + return; } // This should be unreachable