Re: Connector/C++ v 8 and binding parameters
Problem solved: the key lies in keeping the istream that sources the blob around until AFTER executing the update statement. In sketch, suppose you have an unsigned character array "blobdata" of length "bloblen":
sql::Driver* driver = get_driver_instance();
sql::Connection* con = driver->connect("tcp://localhost:3306", <user>, <pw>);
sql::PreparedStatement* stmt = con->prepareStatement(<query string>);
…
std::stringstream* s = new stringstream(string((const char*) blobdata, bloblen), ios::in);
stmt->setBlob(<1-based field # in prepared stmt>, s);
…
stmt->executeUpdate();
delete s;
Subject
Views
Written By
Posted
891
January 24, 2020 12:02PM
439
January 25, 2020 05:04AM
500
January 25, 2020 05:37AM
Re: Connector/C++ v 8 and binding parameters
472
January 27, 2020 01:05AM
359
January 28, 2020 06:21AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.