Loading mysql-test/r/ndb_blob.result +50 −0 Original line number Diff line number Diff line drop table if exists t1; drop database if exists test2; set autocommit=0; create table t1 ( a int not null primary key, Loading Loading @@ -220,6 +221,55 @@ a b c d 7 7xb7 777 7xdd7 8 8xb8 888 8xdd8 9 9xb9 999 9xdd9 select * from t1 order by a; a b c d 1 1xb1 111 1xdd1 2 2xb2 222 2xdd2 3 3xb3 333 3xdd3 4 4xb4 444 4xdd4 5 5xb5 555 5xdd5 6 6xb6 666 6xdd6 7 7xb7 777 7xdd7 8 8xb8 888 8xdd8 9 9xb9 999 9xdd9 alter table t1 add x int; select * from t1 order by a; a b c d x 1 1xb1 111 1xdd1 NULL 2 2xb2 222 2xdd2 NULL 3 3xb3 333 3xdd3 NULL 4 4xb4 444 4xdd4 NULL 5 5xb5 555 5xdd5 NULL 6 6xb6 666 6xdd6 NULL 7 7xb7 777 7xdd7 NULL 8 8xb8 888 8xdd8 NULL 9 9xb9 999 9xdd9 NULL alter table t1 drop x; select * from t1 order by a; a b c d 1 1xb1 111 1xdd1 2 2xb2 222 2xdd2 3 3xb3 333 3xdd3 4 4xb4 444 4xdd4 5 5xb5 555 5xdd5 6 6xb6 666 6xdd6 7 7xb7 777 7xdd7 8 8xb8 888 8xdd8 9 9xb9 999 9xdd9 create database test2; use test2; CREATE TABLE t2 ( a bigint unsigned NOT NULL PRIMARY KEY, b int unsigned not null, c int unsigned ) engine=ndbcluster; insert into t2 values (1,1,1),(2,2,2); select * from test.t1,t2 where test.t1.a = t2.a order by test.t1.a; a b c d a b c 1 1xb1 111 1xdd1 1 1 1 2 2xb2 222 2xdd2 2 2 2 drop table t2; use test; delete from t1 where c >= 100; commit; select count(*) from t1; Loading mysql-test/t/ndb_blob.test +26 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ --disable_warnings drop table if exists t1; drop database if exists test2; --enable_warnings # Loading Loading @@ -203,6 +204,31 @@ where c >= 100; commit; select * from t1 where c >= 100 order by a; # alter table select * from t1 order by a; alter table t1 add x int; select * from t1 order by a; alter table t1 drop x; select * from t1 order by a; # multi db create database test2; use test2; CREATE TABLE t2 ( a bigint unsigned NOT NULL PRIMARY KEY, b int unsigned not null, c int unsigned ) engine=ndbcluster; insert into t2 values (1,1,1),(2,2,2); select * from test.t1,t2 where test.t1.a = t2.a order by test.t1.a; drop table t2; use test; # range scan delete delete from t1 where c >= 100; commit; Loading ndb/include/ndbapi/NdbBlob.hpp +1 −2 Original line number Diff line number Diff line Loading @@ -234,14 +234,13 @@ private: // define blob table static void getBlobTableName(char* btname, const NdbTableImpl* t, const NdbColumnImpl* c); static void getBlobTable(NdbTableImpl& bt, const NdbTableImpl* t, const NdbColumnImpl* c); // table name char theBlobTableName[BlobTableNameSize]; // ndb api stuff Ndb* theNdb; NdbConnection* theNdbCon; NdbOperation* theNdbOp; NdbTableImpl* theTable; NdbTableImpl* theAccessTable; NdbTableImpl* theBlobTable; const NdbColumnImpl* theColumn; char theFillChar; // sizes Loading ndb/include/ndbapi/NdbDictionary.hpp +4 −0 Original line number Diff line number Diff line Loading @@ -145,6 +145,8 @@ public: }; }; class Table; // forward declaration /** * @class Column * @brief Represents an column in an NDB Cluster table Loading Loading @@ -365,6 +367,8 @@ public: void setIndexOnlyStorage(bool); bool getIndexOnlyStorage() const; const Table * getBlobTable() const; /** * @name ODBC Specific methods * @{ Loading ndb/src/ndbapi/NdbBlob.cpp +6 −7 Original line number Diff line number Diff line Loading @@ -140,7 +140,6 @@ void NdbBlob::init() { theState = Idle; theBlobTableName[0] = 0; theNdb = NULL; theNdbCon = NULL; theNdbOp = NULL; Loading Loading @@ -865,7 +864,7 @@ NdbBlob::readParts(char* buf, Uint32 part, Uint32 count) DBG("readParts part=" << part << " count=" << count); Uint32 n = 0; while (n < count) { NdbOperation* tOp = theNdbCon->getNdbOperation(theBlobTableName); NdbOperation* tOp = theNdbCon->getNdbOperation(theBlobTable); if (tOp == NULL || tOp->readTuple() == -1 || setPartKeyValue(tOp, part + n) == -1 || Loading @@ -887,7 +886,7 @@ NdbBlob::insertParts(const char* buf, Uint32 part, Uint32 count) DBG("insertParts part=" << part << " count=" << count); Uint32 n = 0; while (n < count) { NdbOperation* tOp = theNdbCon->getNdbOperation(theBlobTableName); NdbOperation* tOp = theNdbCon->getNdbOperation(theBlobTable); if (tOp == NULL || tOp->insertTuple() == -1 || setPartKeyValue(tOp, part + n) == -1 || Loading @@ -909,7 +908,7 @@ NdbBlob::updateParts(const char* buf, Uint32 part, Uint32 count) DBG("updateParts part=" << part << " count=" << count); Uint32 n = 0; while (n < count) { NdbOperation* tOp = theNdbCon->getNdbOperation(theBlobTableName); NdbOperation* tOp = theNdbCon->getNdbOperation(theBlobTable); if (tOp == NULL || tOp->updateTuple() == -1 || setPartKeyValue(tOp, part + n) == -1 || Loading @@ -931,7 +930,7 @@ NdbBlob::deleteParts(Uint32 part, Uint32 count) DBG("deleteParts part=" << part << " count=" << count); Uint32 n = 0; while (n < count) { NdbOperation* tOp = theNdbCon->getNdbOperation(theBlobTableName); NdbOperation* tOp = theNdbCon->getNdbOperation(theBlobTable); if (tOp == NULL || tOp->deleteTuple() == -1 || setPartKeyValue(tOp, part + n) == -1) { Loading Loading @@ -1029,12 +1028,11 @@ NdbBlob::atPrepare(NdbConnection* aCon, NdbOperation* anOp, const NdbColumnImpl* // sanity check assert((NDB_BLOB_HEAD_SIZE << 2) == sizeof(Head)); assert(theColumn->m_attrSize * theColumn->m_arraySize == sizeof(Head) + theInlineSize); getBlobTableName(theBlobTableName, theTable, theColumn); const NdbDictionary::Table* bt; const NdbDictionary::Column* bc; if (thePartSize > 0) { if (theStripeSize == 0 || (bt = theNdb->theDictionary->getTable(theBlobTableName)) == NULL || (bt = theColumn->getBlobTable()) == NULL || (bc = bt->getColumn("DATA")) == NULL || bc->getType() != partType || bc->getLength() != (int)thePartSize) { Loading @@ -1042,6 +1040,7 @@ NdbBlob::atPrepare(NdbConnection* aCon, NdbOperation* anOp, const NdbColumnImpl* return -1; } } theBlobTable = & NdbTableImpl::getImpl(*bt); // buffers theKeyBuf.alloc(theTable->m_sizeOfKeysInWords << 2); theAccessKeyBuf.alloc(theAccessTable->m_sizeOfKeysInWords << 2); Loading Loading
mysql-test/r/ndb_blob.result +50 −0 Original line number Diff line number Diff line drop table if exists t1; drop database if exists test2; set autocommit=0; create table t1 ( a int not null primary key, Loading Loading @@ -220,6 +221,55 @@ a b c d 7 7xb7 777 7xdd7 8 8xb8 888 8xdd8 9 9xb9 999 9xdd9 select * from t1 order by a; a b c d 1 1xb1 111 1xdd1 2 2xb2 222 2xdd2 3 3xb3 333 3xdd3 4 4xb4 444 4xdd4 5 5xb5 555 5xdd5 6 6xb6 666 6xdd6 7 7xb7 777 7xdd7 8 8xb8 888 8xdd8 9 9xb9 999 9xdd9 alter table t1 add x int; select * from t1 order by a; a b c d x 1 1xb1 111 1xdd1 NULL 2 2xb2 222 2xdd2 NULL 3 3xb3 333 3xdd3 NULL 4 4xb4 444 4xdd4 NULL 5 5xb5 555 5xdd5 NULL 6 6xb6 666 6xdd6 NULL 7 7xb7 777 7xdd7 NULL 8 8xb8 888 8xdd8 NULL 9 9xb9 999 9xdd9 NULL alter table t1 drop x; select * from t1 order by a; a b c d 1 1xb1 111 1xdd1 2 2xb2 222 2xdd2 3 3xb3 333 3xdd3 4 4xb4 444 4xdd4 5 5xb5 555 5xdd5 6 6xb6 666 6xdd6 7 7xb7 777 7xdd7 8 8xb8 888 8xdd8 9 9xb9 999 9xdd9 create database test2; use test2; CREATE TABLE t2 ( a bigint unsigned NOT NULL PRIMARY KEY, b int unsigned not null, c int unsigned ) engine=ndbcluster; insert into t2 values (1,1,1),(2,2,2); select * from test.t1,t2 where test.t1.a = t2.a order by test.t1.a; a b c d a b c 1 1xb1 111 1xdd1 1 1 1 2 2xb2 222 2xdd2 2 2 2 drop table t2; use test; delete from t1 where c >= 100; commit; select count(*) from t1; Loading
mysql-test/t/ndb_blob.test +26 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ --disable_warnings drop table if exists t1; drop database if exists test2; --enable_warnings # Loading Loading @@ -203,6 +204,31 @@ where c >= 100; commit; select * from t1 where c >= 100 order by a; # alter table select * from t1 order by a; alter table t1 add x int; select * from t1 order by a; alter table t1 drop x; select * from t1 order by a; # multi db create database test2; use test2; CREATE TABLE t2 ( a bigint unsigned NOT NULL PRIMARY KEY, b int unsigned not null, c int unsigned ) engine=ndbcluster; insert into t2 values (1,1,1),(2,2,2); select * from test.t1,t2 where test.t1.a = t2.a order by test.t1.a; drop table t2; use test; # range scan delete delete from t1 where c >= 100; commit; Loading
ndb/include/ndbapi/NdbBlob.hpp +1 −2 Original line number Diff line number Diff line Loading @@ -234,14 +234,13 @@ private: // define blob table static void getBlobTableName(char* btname, const NdbTableImpl* t, const NdbColumnImpl* c); static void getBlobTable(NdbTableImpl& bt, const NdbTableImpl* t, const NdbColumnImpl* c); // table name char theBlobTableName[BlobTableNameSize]; // ndb api stuff Ndb* theNdb; NdbConnection* theNdbCon; NdbOperation* theNdbOp; NdbTableImpl* theTable; NdbTableImpl* theAccessTable; NdbTableImpl* theBlobTable; const NdbColumnImpl* theColumn; char theFillChar; // sizes Loading
ndb/include/ndbapi/NdbDictionary.hpp +4 −0 Original line number Diff line number Diff line Loading @@ -145,6 +145,8 @@ public: }; }; class Table; // forward declaration /** * @class Column * @brief Represents an column in an NDB Cluster table Loading Loading @@ -365,6 +367,8 @@ public: void setIndexOnlyStorage(bool); bool getIndexOnlyStorage() const; const Table * getBlobTable() const; /** * @name ODBC Specific methods * @{ Loading
ndb/src/ndbapi/NdbBlob.cpp +6 −7 Original line number Diff line number Diff line Loading @@ -140,7 +140,6 @@ void NdbBlob::init() { theState = Idle; theBlobTableName[0] = 0; theNdb = NULL; theNdbCon = NULL; theNdbOp = NULL; Loading Loading @@ -865,7 +864,7 @@ NdbBlob::readParts(char* buf, Uint32 part, Uint32 count) DBG("readParts part=" << part << " count=" << count); Uint32 n = 0; while (n < count) { NdbOperation* tOp = theNdbCon->getNdbOperation(theBlobTableName); NdbOperation* tOp = theNdbCon->getNdbOperation(theBlobTable); if (tOp == NULL || tOp->readTuple() == -1 || setPartKeyValue(tOp, part + n) == -1 || Loading @@ -887,7 +886,7 @@ NdbBlob::insertParts(const char* buf, Uint32 part, Uint32 count) DBG("insertParts part=" << part << " count=" << count); Uint32 n = 0; while (n < count) { NdbOperation* tOp = theNdbCon->getNdbOperation(theBlobTableName); NdbOperation* tOp = theNdbCon->getNdbOperation(theBlobTable); if (tOp == NULL || tOp->insertTuple() == -1 || setPartKeyValue(tOp, part + n) == -1 || Loading @@ -909,7 +908,7 @@ NdbBlob::updateParts(const char* buf, Uint32 part, Uint32 count) DBG("updateParts part=" << part << " count=" << count); Uint32 n = 0; while (n < count) { NdbOperation* tOp = theNdbCon->getNdbOperation(theBlobTableName); NdbOperation* tOp = theNdbCon->getNdbOperation(theBlobTable); if (tOp == NULL || tOp->updateTuple() == -1 || setPartKeyValue(tOp, part + n) == -1 || Loading @@ -931,7 +930,7 @@ NdbBlob::deleteParts(Uint32 part, Uint32 count) DBG("deleteParts part=" << part << " count=" << count); Uint32 n = 0; while (n < count) { NdbOperation* tOp = theNdbCon->getNdbOperation(theBlobTableName); NdbOperation* tOp = theNdbCon->getNdbOperation(theBlobTable); if (tOp == NULL || tOp->deleteTuple() == -1 || setPartKeyValue(tOp, part + n) == -1) { Loading Loading @@ -1029,12 +1028,11 @@ NdbBlob::atPrepare(NdbConnection* aCon, NdbOperation* anOp, const NdbColumnImpl* // sanity check assert((NDB_BLOB_HEAD_SIZE << 2) == sizeof(Head)); assert(theColumn->m_attrSize * theColumn->m_arraySize == sizeof(Head) + theInlineSize); getBlobTableName(theBlobTableName, theTable, theColumn); const NdbDictionary::Table* bt; const NdbDictionary::Column* bc; if (thePartSize > 0) { if (theStripeSize == 0 || (bt = theNdb->theDictionary->getTable(theBlobTableName)) == NULL || (bt = theColumn->getBlobTable()) == NULL || (bc = bt->getColumn("DATA")) == NULL || bc->getType() != partType || bc->getLength() != (int)thePartSize) { Loading @@ -1042,6 +1040,7 @@ NdbBlob::atPrepare(NdbConnection* aCon, NdbOperation* anOp, const NdbColumnImpl* return -1; } } theBlobTable = & NdbTableImpl::getImpl(*bt); // buffers theKeyBuf.alloc(theTable->m_sizeOfKeysInWords << 2); theAccessKeyBuf.alloc(theAccessTable->m_sizeOfKeysInWords << 2); Loading