From 68ab60694fff1528afd8045e8808986a8ab0ea00 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 10 Jun 2004 14:02:31 +0200 Subject: [PATCH] merge ndb api blobs --- ndb/include/ndbapi/NdbDictionary.hpp | 8 ++ ndb/src/ndbapi/NdbOperation.cpp | 4 +- ndb/src/ndbapi/Ndberr.cpp | 8 -- ndb/test/ndbapi/{testBlobs => }/testBlobs.cpp | 0 ndb/test/src/NDBT_Table.cpp | 135 ++++++------------ 5 files changed, 55 insertions(+), 100 deletions(-) rename ndb/test/ndbapi/{testBlobs => }/testBlobs.cpp (100%) diff --git a/ndb/include/ndbapi/NdbDictionary.hpp b/ndb/include/ndbapi/NdbDictionary.hpp index 90e7d80ef29..3b38e33ec91 100644 --- a/ndb/include/ndbapi/NdbDictionary.hpp +++ b/ndb/include/ndbapi/NdbDictionary.hpp @@ -321,6 +321,11 @@ public: void setStripeSize(int size) { setLength(size); } int getStripeSize() const { return getLength(); } + /** + * Get size of element + */ + int Column::getSize() const; + /** * Set distribution key * @@ -372,6 +377,7 @@ public: #endif private: + friend class NdbRecAttr; friend class NdbColumnImpl; class NdbColumnImpl & m_impl; Column(NdbColumnImpl&); @@ -1054,4 +1060,6 @@ public: }; }; +class NdbOut& operator <<(class NdbOut& ndbout, const NdbDictionary::Column::Type type); + #endif diff --git a/ndb/src/ndbapi/NdbOperation.cpp b/ndb/src/ndbapi/NdbOperation.cpp index d0d2839a6ab..e6031a58c5f 100644 --- a/ndb/src/ndbapi/NdbOperation.cpp +++ b/ndb/src/ndbapi/NdbOperation.cpp @@ -32,7 +32,7 @@ #include "NdbRecAttr.hpp" #include "NdbUtil.hpp" #include "NdbBlob.hpp" - +#include "ndbapi_limits.h" #include #include "NdbDictionaryImpl.hpp" @@ -165,7 +165,7 @@ NdbOperation::init(NdbTableImpl* tab, NdbConnection* myConnection){ m_currentTable = m_accessTable = tab; theNdbCon = myConnection; - for (Uint32 i=0; i #include "NdbImpl.hpp" #include "NdbDictionaryImpl.hpp" -#include #include #include #include @@ -68,13 +67,6 @@ NdbOperation::getNdbError() const { return theError; } -const -NdbError & -NdbSchemaCon::getNdbError() const { - update(theError); - return theError; -} - const NdbError & NdbBlob::getNdbError() const { diff --git a/ndb/test/ndbapi/testBlobs/testBlobs.cpp b/ndb/test/ndbapi/testBlobs.cpp similarity index 100% rename from ndb/test/ndbapi/testBlobs/testBlobs.cpp rename to ndb/test/ndbapi/testBlobs.cpp diff --git a/ndb/test/src/NDBT_Table.cpp b/ndb/test/src/NDBT_Table.cpp index 6112e79aa87..485377e690a 100644 --- a/ndb/test/src/NDBT_Table.cpp +++ b/ndb/test/src/NDBT_Table.cpp @@ -14,112 +14,35 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "NDBT_Table.hpp" +#include #include #include - class NdbOut& operator <<(class NdbOut& ndbout, const NDBT_Attribute & attr){ NdbDictionary::Column::Type type = attr.getType(); - bool key = attr.getPrimaryKey(); - bool null = attr.getNullable(); - ndbout << attr.getName() << "\t"; - char tmp[100]; - if(attr.getLength() != 1) - snprintf(tmp, 100," [%d]", attr.getLength()); - else - tmp[0] = 0; + ndbout << attr.getName() << " " << type; switch(type){ - case NdbDictionary::Column::Tinyint: - ndbout << "Tinyint" << tmp; - break; - case NdbDictionary::Column::Tinyunsigned: - ndbout << "Tinyunsigned" << tmp; - break; - case NdbDictionary::Column::Smallint: - ndbout << "Smallint" << tmp; - break; - case NdbDictionary::Column::Smallunsigned: - ndbout << "Smallunsigned" << tmp; - break; - case NdbDictionary::Column::Mediumint: - ndbout << "Mediumint" << tmp; - break; - case NdbDictionary::Column::Mediumunsigned: - ndbout << "Mediumunsigned" << tmp; - break; - case NdbDictionary::Column::Int: - ndbout << "Int" << tmp; - break; - case NdbDictionary::Column::Unsigned: - ndbout << "Unsigned" << tmp; - break; - case NdbDictionary::Column::Bigint: - ndbout << "Bigint" << tmp; - break; - case NdbDictionary::Column::Bigunsigned: - ndbout << "Bigunsigned" << tmp; - break; - case NdbDictionary::Column::Float: - ndbout << "Float" << tmp; - break; - case NdbDictionary::Column::Double: - ndbout << "Double" << tmp; - break; case NdbDictionary::Column::Decimal: - ndbout << "Decimal(" - << attr.getScale() << ", " << attr.getPrecision() << ")" - << tmp; - break; - case NdbDictionary::Column::Char: - ndbout << "Char(" << attr.getLength() << ")"; - break; - case NdbDictionary::Column::Varchar: - ndbout << "Varchar(" << attr.getLength() << ")"; - break; - case NdbDictionary::Column::Binary: - ndbout << "Binary(" << attr.getLength() << ")"; - break; - case NdbDictionary::Column::Varbinary: - ndbout << "Varbinary(" << attr.getLength() << ")"; - break; - case NdbDictionary::Column::Datetime: - ndbout << "Datetime" << tmp; - break; - case NdbDictionary::Column::Timespec: - ndbout << "Timespec" << tmp; - break; - case NdbDictionary::Column::Blob: - ndbout << "Blob(" << attr.getInlineSize() - << "," << attr.getPartSize() - << "," << attr.getStripeSize() << ")"; - break; - case NdbDictionary::Column::Clob: - ndbout << "Clob(" << attr.getInlineSize() - << "," << attr.getPartSize() - << "," << attr.getStripeSize() << ")"; - break; - case NdbDictionary::Column::Undefined: - ndbout << "Undefined" << tmp; + ndbout << "(" << attr.getScale() << ", " << attr.getPrecision() << ")"; break; default: - ndbout << "Unknown(" << type << ")"; + break; } - ndbout << "\t"; - if(null){ - ndbout << "NULL"; - } else { - ndbout << "NOT NULL"; - } - ndbout << "\t"; + if(attr.getLength() != 1) + ndbout << "[" << attr.getLength() << "]"; + + if(attr.getNullable()) + ndbout << " NULL"; + else + ndbout << " NOT NULL"; - if(key) - ndbout << "\tprimary key"; + if(attr.getPrimaryKey()) + ndbout << " PRIMARY KEY"; return ndbout; } @@ -137,6 +60,9 @@ operator <<(class NdbOut& ndbout, const NDBT_Table & tab) ndbout << "Temporary table: " << (tab.getStoredTable() ? "no" : "yes") << endl; ndbout << "Number of attributes: " << tab.getNoOfColumns() << endl; ndbout << "Number of primary keys: " << tab.getNoOfPrimaryKeys() << endl; + ndbout << "Length of frm data: " << tab.getFrmLength() << endl; + + //<< ((tab.getTupleKey() == TupleId) ? " tupleid" : "") <getName(); + if (i < idx.getNoOfColumns()-1) + ndbout << ", "; + } + ndbout << ")"; + + ndbout << " - "; + switch (idx.getType()) { + case NdbDictionary::Object::UniqueHashIndex: + ndbout << "UniqueHashIndex"; + break; + case NdbDictionary::Object::OrderedIndex: + ndbout << "OrderedIndex"; + break; + default: + ndbout << "Type " << idx.getType(); + break; + } + return ndbout; +} +