本文介绍了在MySQL Connector/C ++中使用setblob设置二进制数据会导致崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试如下使用setBlob():
I tried to use setBlob() as follows:
class DataBuf : public streambuf
{
public:
DataBuf(char * d, size_t s) {
setg(d, d, d + s);
}
};
char b[20];
DataBuf buffer((char*)b, 20);
istream stream(&buffer);
PreparedStatement* s = con->PrepareStatement("insert into mytable (mybin) values (?)");
s->setBlob(1, &stream);
int rows = s->executeUpdate();
这在executeUpdate()时崩溃.我在做什么错了?
This crashes at executeUpdate(). What am I doing wrong?
推荐答案
您确定它没有崩溃:
s->setBlob(1, &stream);
检查调试器,确保s不是NULL或废话值.
Check the debugger to make sure that s isn't NULL, or a crap value.
这篇关于在MySQL Connector/C ++中使用setblob设置二进制数据会导致崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!