diff options
Diffstat (limited to 'cpp/src/qpid/store/ms-sql/VariantHelper.cpp')
-rw-r--r-- | cpp/src/qpid/store/ms-sql/VariantHelper.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/cpp/src/qpid/store/ms-sql/VariantHelper.cpp b/cpp/src/qpid/store/ms-sql/VariantHelper.cpp index 786724f031..acec95c1f9 100644 --- a/cpp/src/qpid/store/ms-sql/VariantHelper.cpp +++ b/cpp/src/qpid/store/ms-sql/VariantHelper.cpp @@ -41,13 +41,25 @@ VariantHelper<Wrapped>::operator const _variant_t& () const // Specialization for using _variant_t to wrap a std::string VariantHelper<std::string>::VariantHelper(const std::string &init) { - var.SetString(init.c_str()); + if (init.empty() || init.length() == 0) { + var.vt = VT_BSTR; + var.bstrVal = NULL; + } + else { + var.SetString(init.c_str()); + } } VariantHelper<std::string>& VariantHelper<std::string>::operator=(const std::string &rhs) { - var.SetString(rhs.c_str()); + if (rhs.empty() || rhs.length() == 0) { + var.vt = VT_BSTR; + var.bstrVal = NULL; + } + else { + var.SetString(rhs.c_str()); + } return *this; } |