diff --git a/src/framework/orm.h b/src/framework/orm.h index cb55ac8..6196a87 100644 --- a/src/framework/orm.h +++ b/src/framework/orm.h @@ -155,6 +155,16 @@ namespace ORM { return S; } + inline std::string to_string(const Poco::Data::BLOB &blob) { + auto Content = blob.content(); + std::string result; + result.reserve(Content.size()); + for(const auto &c:Content) { + result += (char) c; + } + return result; + } + inline std::string to_string(const char * S) { return S; } diff --git a/src/storage/orm_avatar.cpp b/src/storage/orm_avatar.cpp index 3586eec..2c605af 100644 --- a/src/storage/orm_avatar.cpp +++ b/src/storage/orm_avatar.cpp @@ -72,19 +72,19 @@ namespace OpenWifi { if(GetRecord("id",Id,A)) { Type = A.type; Name = A.name; - if(StorageService()->Type() == DBType::pgsql) { -// Poco::Data::BLOBInputStream IL(A.avatar); + AvatarContent = ORM::to_string(A.avatar); +/* if(StorageService()->Type() == DBType::pgsql) { + Poco::Data::BLOBInputStream IL(A.avatar); auto Content = A.avatar.content(); for(const auto &c:Content) { AvatarContent += (char) c; } -/* while(IL.std::basic_ios::good()) { + + while(IL.std::basic_ios::good()) { char buf[16000]; std::size_t Size = IL.readsome((unsigned char *)buf,16000); AvatarContent += std::string{buf,Size}; } -*/ -/* Poco::StreamCopier::copyStream(IL, os); IL. std::string tmp = os.str().substr(2); @@ -92,16 +92,15 @@ namespace OpenWifi { for(size_t i=0;i