Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/55.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
c++;Mysql在数据库中保存二进制blob 所以我在Ubuntu 64位机上使用G++和Mysqlcppconn(MySQL C++连接器)。我想将二进制数据块插入数据库并能够检索它。 视网膜 typedef unsigned char byte; byte data[512]; istream *buf=res->getBlob(1); buf->read((char*)data,512);_C++_Mysql_Mysql Connector - Fatal编程技术网

c++;Mysql在数据库中保存二进制blob 所以我在Ubuntu 64位机上使用G++和Mysqlcppconn(MySQL C++连接器)。我想将二进制数据块插入数据库并能够检索它。 视网膜 typedef unsigned char byte; byte data[512]; istream *buf=res->getBlob(1); buf->read((char*)data,512);

c++;Mysql在数据库中保存二进制blob 所以我在Ubuntu 64位机上使用G++和Mysqlcppconn(MySQL C++连接器)。我想将二进制数据块插入数据库并能够检索它。 视网膜 typedef unsigned char byte; byte data[512]; istream *buf=res->getBlob(1); buf->read((char*)data,512);,c++,mysql,mysql-connector,C++,Mysql,Mysql Connector,我只是希望这能奏效,但我不太确定。这是一个结果集 为了存储在数据库中,我不知道如何将字节*转换为istream Thanx用于读取。答案在于使用流缓冲区在数据库中写入blob struct membuf: std::streambuf { membuf(char* b, char* e) { this->setg(b, b, e); } }; byte *p = something....; membuf buf((char*)p,(char*)p+ALPHABET_SIZE*s

我只是希望这能奏效,但我不太确定。这是一个结果集

为了存储在数据库中,我不知道如何将字节*转换为istream


Thanx用于读取。

答案在于使用流缓冲区在数据库中写入blob

struct membuf: std::streambuf
{
    membuf(char* b, char* e) { this->setg(b, b, e); }
};

byte *p = something....;
membuf buf((char*)p,(char*)p+ALPHABET_SIZE*sizeof(ull));
istream is(&buf);

ps->setBlob(1,&is);
这是一份准备好的声明:)