Commit 80213d66 authored by unknown's avatar unknown

some ndb printout cleanup


ndb/src/ndbapi/NdbDictionary.cpp:
  Print cleanup
ndb/test/src/NDBT_ResultRow.cpp:
  Print error
ndb/test/src/NDBT_Table.cpp:
  Print cleanup
parent 46de0999
...@@ -807,67 +807,67 @@ NdbOut& operator <<(NdbOut& ndbout, const NdbDictionary::Column::Type type) ...@@ -807,67 +807,67 @@ NdbOut& operator <<(NdbOut& ndbout, const NdbDictionary::Column::Type type)
{ {
switch(type){ switch(type){
case NdbDictionary::Column::Bigunsigned: case NdbDictionary::Column::Bigunsigned:
ndbout << "[Bigunsigned]"; ndbout << "Bigunsigned";
break; break;
case NdbDictionary::Column::Unsigned: case NdbDictionary::Column::Unsigned:
ndbout << "[Unsigned]"; ndbout << "Unsigned";
break; break;
case NdbDictionary::Column::Smallunsigned: case NdbDictionary::Column::Smallunsigned:
ndbout << "[Smallunsigned]"; ndbout << "Smallunsigned";
break; break;
case NdbDictionary::Column::Tinyunsigned: case NdbDictionary::Column::Tinyunsigned:
ndbout << "[Tinyunsigned]"; ndbout << "Tinyunsigned";
break; break;
case NdbDictionary::Column::Bigint: case NdbDictionary::Column::Bigint:
ndbout << "[Bigint]"; ndbout << "Bigint";
break; break;
case NdbDictionary::Column::Int: case NdbDictionary::Column::Int:
ndbout << "[Int]"; ndbout << "Int";
break; break;
case NdbDictionary::Column::Smallint: case NdbDictionary::Column::Smallint:
ndbout << "[Smallint]"; ndbout << "Smallint";
break; break;
case NdbDictionary::Column::Tinyint: case NdbDictionary::Column::Tinyint:
ndbout << "[Tinyint]"; ndbout << "Tinyint";
break; break;
case NdbDictionary::Column::Char: case NdbDictionary::Column::Char:
ndbout << "[Char]"; ndbout << "Char";
break; break;
case NdbDictionary::Column::Varchar: case NdbDictionary::Column::Varchar:
ndbout << "[Varchar]"; ndbout << "Varchar";
break; break;
case NdbDictionary::Column::Float: case NdbDictionary::Column::Float:
ndbout << "[Float]"; ndbout << "Float";
break; break;
case NdbDictionary::Column::Double: case NdbDictionary::Column::Double:
ndbout << "[Double]"; ndbout << "Double";
break; break;
case NdbDictionary::Column::Mediumint: case NdbDictionary::Column::Mediumint:
ndbout << "[Mediumint]"; ndbout << "Mediumint";
break; break;
case NdbDictionary::Column::Mediumunsigned: case NdbDictionary::Column::Mediumunsigned:
ndbout << "[Mediumunsigend]"; ndbout << "Mediumunsigend";
break; break;
case NdbDictionary::Column::Binary: case NdbDictionary::Column::Binary:
ndbout << "[Binary]"; ndbout << "Binary";
break; break;
case NdbDictionary::Column::Varbinary: case NdbDictionary::Column::Varbinary:
ndbout << "[Varbinary]"; ndbout << "Varbinary";
break; break;
case NdbDictionary::Column::Decimal: case NdbDictionary::Column::Decimal:
ndbout << "[Decimal]"; ndbout << "Decimal";
break; break;
case NdbDictionary::Column::Timespec: case NdbDictionary::Column::Timespec:
ndbout << "[Timespec]"; ndbout << "Timespec";
break; break;
case NdbDictionary::Column::Blob: case NdbDictionary::Column::Blob:
ndbout << "[Blob]"; ndbout << "Blob";
break; break;
case NdbDictionary::Column::Undefined: case NdbDictionary::Column::Undefined:
ndbout << "[Undefined]"; ndbout << "Undefined";
break; break;
default: default:
ndbout << "[Unknown type]"; ndbout << "Unknown type=" << (Uint32)type;
break; break;
} }
......
...@@ -110,16 +110,10 @@ BaseString NDBT_ResultRow::c_str() { ...@@ -110,16 +110,10 @@ BaseString NDBT_ResultRow::c_str() {
return str; return str;
} }
/**
* TODO This should share the same printer function as in
* NdbEventOperationImpl.cpp, using new types of course :)
*/
NdbOut & NdbOut &
operator << (NdbOut& ndbout, const NDBT_ResultRow & res) { operator << (NdbOut& ndbout, const NDBT_ResultRow & res) {
for(int i = 0; i<res.cols; i++) for(int i = 0; i<res.cols; i++)
ndbout << res.data[i]; ndbout << *(res.data[i]) << "\t";
return ndbout; return ndbout;
} }
......
...@@ -14,105 +14,35 @@ ...@@ -14,105 +14,35 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "NDBT_Table.hpp" #include <NDBT_Table.hpp>
#include <NdbTimer.hpp> #include <NdbTimer.hpp>
#include <NDBT.hpp> #include <NDBT.hpp>
class NdbOut& class NdbOut&
operator <<(class NdbOut& ndbout, const NDBT_Attribute & attr){ operator <<(class NdbOut& ndbout, const NDBT_Attribute & attr){
NdbDictionary::Column::Type type = attr.getType(); NdbDictionary::Column::Type type = attr.getType();
bool key = attr.getPrimaryKey();
bool null = attr.getNullable();
ndbout << attr.getName() << " "; ndbout << attr.getName() << " " << type;
char tmp[100];
if(attr.getLength() != 1)
snprintf(tmp, 100," [%d]", attr.getLength());
else
tmp[0] = 0;
switch(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: case NdbDictionary::Column::Decimal:
ndbout << "Decimal(" ndbout << "(" << attr.getScale() << ", " << attr.getPrecision() << ")";
<< 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" << tmp;
break;
case NdbDictionary::Column::Undefined:
ndbout << "Undefined" << tmp;
break; break;
default: default:
ndbout << "Unknown(" << type << ")"; break;
} }
ndbout << " "; if(attr.getLength() != 1)
if(null){ ndbout << "[" << attr.getLength() << "]";
ndbout << "NULL";
} else { if(attr.getNullable())
ndbout << "NOT NULL"; ndbout << " NULL";
} else
ndbout << " "; ndbout << " NOT NULL";
if(key) if(attr.getPrimaryKey())
ndbout << "PRIMARY KEY"; ndbout << " PRIMARY KEY";
return ndbout; return ndbout;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment