1

我尝试使用 setBlob() 如下:


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() 处崩溃。我究竟做错了什么?

4

1 回答 1

1

你确定它没有崩溃:

s->setBlob(1, &stream);

检查调试器以确保 s 不是 NULL 或废话值。

于 2009-07-13T23:18:39.873 回答