/* In MySQL Cluster 6.3 this correctly creates an ApplicationError "4116 Operation was not defined correctly, probably missing a key". But with MySQL Cluster 7.0 we see a failed assertion. */ /* How to build the test program: MYSQL_HOME=/whereever g++ -I $MYSQL_HOME/include/mysql -I $MYSQL_HOME/include/mysql/storage/ndb \ -I$MYSQL_HOME/include/mysql/storage/ndb/ndbapi \ -L$MYSQL_HOME/lib/mysql -lndbclient \ -o blob-bug blob-bug.cc The MySQL table used in this test: USE test; CREATE TABLE typ8 ( id int not null primary key , doc text ) engine = ndbcluster; */ #include "NdbApi.hpp" #include #include #include #define APIERROR(error) die(error.message) void die(const char *s) { puts(s); exit(-1); } int main() { const char * the_string ="Here we have some text."; ndb_init(); Ndb_cluster_connection cluster_connection(NULL); if (cluster_connection.connect(4, 5, 1)) die("Unable to connect to cluster within 30 secs."); if (cluster_connection.wait_until_ready(30,0) < 0) die("Cluster was not ready within 30 secs.\n"); Ndb myNdb(&cluster_connection,"test"); if (myNdb.init(1024) == -1) APIERROR(myNdb.getNdbError()); const NdbDictionary::Dictionary *myDict= myNdb.getDictionary(); printf("getting table: \n"); const NdbDictionary::Table *myTable= myDict->getTable("typ8"); NdbTransaction *myTrans= myNdb.startTransaction(); if (myTrans == NULL) APIERROR(myNdb.getNdbError()); printf("getting NdbOperation: \n"); NdbOperation *myNdbOperation= myTrans->getNdbOperation(myTable); if (myNdbOperation == NULL) APIERROR(myTrans->getNdbError()); myNdbOperation->insertTuple(); printf("getting blob handle: \n"); NdbBlob *myBlobHandle= myNdbOperation->getBlobHandle("doc"); if (myBlobHandle == NULL) APIERROR(myNdbOperation->getNdbError()); myBlobHandle->setValue(the_string, strlen(the_string)); myTrans->executePendingBlobOps(); /* In MySQL Cluster 6.3 this correctly creates an ApplicationError "4116 Operation was not defined correctly, probably missing a key". */ printf("executing transaction: \n"); myTrans->execute(NdbTransaction::Commit); const NdbError &error = myTrans->getNdbError(); printf("tx execute: [%d:%d] %s %s \n", error.classification, error.code, error.message, error.details); }