mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-24 09:12:28 +02:00
#3318: Data: Support Poco::UUID for data binding
This commit is contained in:
@@ -176,6 +176,13 @@ void Binder::bind(std::size_t pos, const Time& val, Direction dir)
|
||||
}
|
||||
|
||||
|
||||
void Binder::bind(std::size_t pos, const UUID& val, Direction dir)
|
||||
{
|
||||
poco_assert(dir == PD_IN);
|
||||
realBind(pos, Poco::Data::MetaColumn::FDT_UUID, &val, sizeof(UUID));
|
||||
}
|
||||
|
||||
|
||||
void Binder::bind(std::size_t pos, const NullData&, Direction dir)
|
||||
{
|
||||
poco_assert(dir == PD_IN);
|
||||
@@ -293,6 +300,14 @@ void Binder::updateBindVectorToCurrentValues()
|
||||
const Poco::Data::CLOB& clob = * static_cast<const Poco::Data::CLOB*>(itr->pData());
|
||||
itr->setNonStringVersionRepresentation(static_cast<const void*> (clob.rawContent()), clob.size());
|
||||
}
|
||||
break;
|
||||
|
||||
case Poco::Data::MetaColumn::FDT_UUID:
|
||||
{
|
||||
const Poco::UUID& uuid = * static_cast<const Poco::UUID*>(itr->pData());
|
||||
itr->setStringVersionRepresentation(uuid.toString());
|
||||
}
|
||||
break;
|
||||
|
||||
case Poco::Data::MetaColumn::FDT_UNKNOWN:
|
||||
default:
|
||||
|
||||
@@ -432,6 +432,19 @@ bool Extractor::extract(std::size_t pos, Time& val)
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, UUID& val)
|
||||
{
|
||||
OutputParameter outputParameter = extractPreamble(pos);
|
||||
|
||||
if (isColumnNull(outputParameter))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return val.tryParse(outputParameter.pData());
|
||||
}
|
||||
|
||||
|
||||
bool Extractor::extract(std::size_t pos, Any& val)
|
||||
{
|
||||
return extractStringImpl(pos, val);
|
||||
@@ -583,6 +596,14 @@ bool Extractor::extractToDynamic(std::size_t pos, Dynamic::Var& val)
|
||||
val = dt;
|
||||
break;
|
||||
}
|
||||
case UUIDOID:
|
||||
{
|
||||
UUID uuid;
|
||||
success = extract(pos, uuid);
|
||||
if (success)
|
||||
val = uuid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return success;
|
||||
|
||||
@@ -94,6 +94,11 @@ Poco::Data::MetaColumn::ColumnDataType oidToColumnDataType(const Oid anOID)
|
||||
cdt = Poco::Data::MetaColumn::FDT_TIMESTAMP;
|
||||
break;
|
||||
|
||||
//uuid
|
||||
case UUIDOID:
|
||||
cdt = Poco::Data::MetaColumn::FDT_BLOB;
|
||||
break;
|
||||
|
||||
// everything else is a string
|
||||
default:
|
||||
cdt = Poco::Data::MetaColumn::FDT_STRING;
|
||||
|
||||
Reference in New Issue
Block a user