1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 00:37:15 +01:00

Enable boolean vectors support in poco data.

This commit is contained in:
Sandu Liviu Catalin 2021-02-12 11:59:09 +02:00
parent b897cde9e5
commit a526cc7597
2 changed files with 17 additions and 13 deletions

View File

@ -202,9 +202,8 @@ void SqDataStatement::UseInst_(LightObj & obj, const std::string & name, Poco::D
} // Bool vector reference?
else if (type == StaticClassTypeTag< SqVector< bool > >::Get())
{
// There is no point in having these
// Their usefulness is limited and pointless compared to the number of specializations needed get them to work
STHROWF("Boolean vectors are not implemented");
auto p = obj.CastI< SqVector< bool > >();
addBind(new Poco::Data::ReferenceBinding< std::vector< bool > >(p->ValidRef(), name, dir));
} // Unknown!
else
{
@ -289,9 +288,7 @@ void SqDataStatement::BindInst_(LightObj & obj, const std::string & name, Poco::
} // Bool vector reference?
else if (type == StaticClassTypeTag< SqVector< bool > >::Get())
{
// There is no point in having these
// Their usefulness is limited and pointless compared to the number of specializations needed get them to work
STHROWF("Boolean vectors are not implemented");
addBind(new Poco::Data::CopyBinding< std::vector< bool > >(obj.CastI< SqVector< bool > >()->Valid(), name, dir));
} // Unknown!
else
{
@ -337,9 +334,7 @@ SqDataStatement & SqDataStatement::Into(LightObj & obj)
} // Bool vector reference?
else if (type == StaticClassTypeTag< SqVector< bool > >::Get())
{
// There is no point in having these
// Their usefulness is limited and pointless compared to the number of specializations needed get them to work
STHROWF("Boolean vectors are not implemented");
addExtract(new Poco::Data::ReferenceExtraction< std::vector< bool > >(obj.CastI< SqVector< bool > >()->ValidRef()));
} // Unknown!
else
{
@ -386,9 +381,7 @@ SqDataStatement & SqDataStatement::Into_(LightObj & obj, LightObj & def)
} // Bool vector reference?
else if (type == StaticClassTypeTag< SqVector< bool > >::Get())
{
// There is no point in having these
// Their usefulness is limited and pointless compared to the number of specializations needed get them to work
STHROWF("Boolean vectors are not implemented");
addExtract(new Poco::Data::ReferenceExtraction< std::vector< bool > >(obj.CastI< SqVector< bool > >()->ValidRef(), def.Cast< bool >()));
} // Unknown!
else
{

View File

@ -437,7 +437,7 @@ protected:
/* --------------------------------------------------------------------------------------------
* Retrieve the container with the extracted values.
*/
const std::vector<T>& result() const
SQMOD_NODISCARD const std::vector<T>& result() const
{
return *m_Result;
}
@ -448,6 +448,17 @@ private:
std::deque< bool > m_Nulls;
};
// ------------------------------------------------------------------------------------------------
template <> std::size_t ReferenceExtraction< std::vector<bool> >::extract(std::size_t pos)
{
AbstractExtractor::Ptr ext = getExtractor();
bool tmp = m_Default;
TypeHandler<bool>::extract(pos, tmp, m_Default, ext);
m_Result->push_back(tmp);
m_Nulls.push_back(ext->isNull(pos));
return 1u;
}
} // Namespace:: Data
} // Namespace:: Poco