【IT专家】使用SQLite包装器在POCO框架中绑定BLOB的数据

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

【IT专家】使用SQLite包装器在POCO框架中绑定BLOB的
数据
本文由我司收集整编,推荐下载,如有疑问,请与我司联系使用SQLite 包装器在POCO 框架中绑定BLOB 的数据使用SQLite 包装器在POCO 框架中绑定BLOB 的数据[英]Bind data for BLOB in POCO framework using SQLite wrapper I am trying to bind a binary data to save the data in a BLOB column of SQLite using POCO framework, however, I can not figure out, how to achieve the desired results.
我正在尝试使用POCO 框架绑定二进制数据以将数据保存在SQLite 的BLOB 列
中,但是,我无法弄清楚,如何实现所需的结果。

My code:
#include Poco/Data/Session.h #include Poco/Data/SessionPool.h #include Poco/Data/SQLite/Connector.h . . .。

const std::string dbSchemeDemo = “CREATE TABLE IF NOT EXISTS `demo` (““\n\t`key`\tTEXT NOT NULL,”“\n\t`value`\tINTEGER DEFAULT NULL,”
“\n\t`data`\tBLOB DEFAULT N ULL,”“\n\tPRIMARY KEY(`key`)”“\n);”“\nCREATE INDEX IF NOT EXISTS idx_key ON demo(key);”;std::string sqlQueryDemo = “INSERT INTO demo”“(key, value, data)”“VALUES(?, ?, ?)”;auto dbPoolDemo = std::make_unique Poco::Data::SessionPool (Poco::Data::SQLite::Connector::KEY,
“demo.db3”);Poco::Data::SQLite::Connector::registerConnector ();Poco::Data::Session dbDemo(dbPoolDemo- get());dbDemo.setConnectionTimeout(2);dbDemo “PRAGMA
foreign_keys = ON;”,Poco::Data::Keywords::now;dbDemo dbSchemeDemo, Poco::Data::Keywords::now;std::vector unsigned char data{ ‘0’,‘0’,‘0’,‘0’,‘0’,‘0’,‘0’,‘0’,‘0’,‘0’};Poco::Data::Statement
insertDemo(dbDemo);insertDemo sqlQueryDemo, Poco::Data::Keywords::bind(“ABCD”),Poco::Data::Keywords::bin d(Poco::Nullable int (1)), Poco::Data::Keywords::bind(Poco::Nullable std::vector unsigned char (data)), Poco::Data::Keywords::now; The exception “Not implemented” is thown. Any idea, how to bind a binary data from vector? Thanks a lot!。

相关文档
最新文档