{ // Create mysql server and prepare statement string connectString = "mysql://localhost/AMORE"; fMySQLServer = new TMySQLServer(connectString.c_str(), "daq", "daq"); string stat = "REPLACE INTO aloneldcped (moname, updatetime, data) values (?,?,?)"; TMySQLStatement* statement = (TMySQLStatement*) fMySQLServer->Statement(stat.c_str(), 1); statement->NextIteration(); statement->SetString(0, "test"); statement->SetTimestamp(1, 2009, 1, 1, 1, 1, 1); // prepare the big string ostringstream stream; for (int i = 0 ; i < 1350 ; i++) {stream << "123456789 123456789 123456789 123456789 123456789" << endl;} TObjString testString(stream.str().c_str()); TMessage message; message.WriteObject(&testString); statement->SetBinary(2, message.Buffer(), message.Length() + sizeof(UInt_t)); // process the statement to insert data statement->Process(); // retrieve the data string sql = "SELECT data FROM aloneldcped WHERE moname = 'test'"; statement = (TMySQLStatement*) fMySQLServer->Statement(sql.c_str()); statement->Process(); statement->StoreResult(); statement->NextResultRow(); unsigned char* blob = 0; Long_t blobSize; r = statement->GetBinary(0, (void*&) blob, blobSize); if (r == kFALSE) { std::cerr << "Problem retrieving data with query : " << std::endl << " " << sql << std::endl; } else { std::cerr << "Properly retrieved data." << std::endl; } }