mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-18 04:10:33 +01:00
b0581433a7
fix: remove executable flag and change back to 100644 (was 100755) Signed-off-by: Roger Meier <r.meier@siemens.com>
77 lines
1.3 KiB
C++
77 lines
1.3 KiB
C++
//
|
|
// DynamicLOB.cpp
|
|
//
|
|
// $Id: //poco/Main/Data/src/DynamicLOB.cpp#1 $
|
|
//
|
|
// Library: Data
|
|
// Package: DataCore
|
|
// Module: DynamicLOB
|
|
//
|
|
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
|
// and Contributors.
|
|
//
|
|
// SPDX-License-Identifier: BSL-1.0
|
|
//
|
|
|
|
|
|
#ifdef __GNUC__
|
|
// TODO: determine g++ version able to do the right thing without these specializations
|
|
|
|
#include "Poco/Data/DynamicLOB.h"
|
|
#include "Poco/Data/LOB.h"
|
|
#include "Poco/Dynamic/Var.h"
|
|
|
|
|
|
namespace Poco {
|
|
namespace Dynamic {
|
|
|
|
|
|
using Poco::Data::CLOB;
|
|
using Poco::Data::BLOB;
|
|
|
|
|
|
template <>
|
|
Var::operator CLOB () const
|
|
{
|
|
VarHolder* pHolder = content();
|
|
|
|
if (!pHolder)
|
|
throw InvalidAccessException("Can not convert empty value.");
|
|
|
|
if (typeid(CLOB) == pHolder->type())
|
|
return extract<CLOB>();
|
|
else
|
|
{
|
|
std::string result;
|
|
pHolder->convert(result);
|
|
return CLOB(result);
|
|
}
|
|
}
|
|
|
|
|
|
template <>
|
|
Var::operator BLOB () const
|
|
{
|
|
VarHolder* pHolder = content();
|
|
|
|
if (!pHolder)
|
|
throw InvalidAccessException("Can not convert empty value.");
|
|
|
|
if (typeid(BLOB) == pHolder->type())
|
|
return extract<BLOB>();
|
|
else
|
|
{
|
|
std::string result;
|
|
pHolder->convert(result);
|
|
return BLOB(reinterpret_cast<const unsigned char*>(result.data()),
|
|
result.size());
|
|
}
|
|
}
|
|
|
|
|
|
} } // namespace Poco::Data
|
|
|
|
|
|
#endif // __GNUC__
|
|
|