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

View File

@ -437,7 +437,7 @@ protected:
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Retrieve the container with the extracted values. * Retrieve the container with the extracted values.
*/ */
const std::vector<T>& result() const SQMOD_NODISCARD const std::vector<T>& result() const
{ {
return *m_Result; return *m_Result;
} }
@ -448,6 +448,17 @@ private:
std::deque< bool > m_Nulls; 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:: Data
} // Namespace:: Poco } // Namespace:: Poco