1

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();

This crashes at executeUpdate(). What am I doing wrong?

1
  • Is it a hard crash or do any error messages show up? Does the debugger catch anything? Commented Jul 13, 2009 at 19:34

1 Answer 1

1

Are you sure that it isn't crashing on:

s->setBlob(1, &stream);

Check the debugger to make sure that s isn't NULL, or a crap value.

Sign up to request clarification or add additional context in comments.

1 Comment

No, Im stepping through line by line. Crashes in non-debug mode too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.