/* Copyright (c) 2003-2005 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #include #include "NDBT_ResultRow.hpp" #include #include NDBT_ResultRow::NDBT_ResultRow(const NdbDictionary::Table& tab, char attrib_delimiter) : m_table(tab) { assert(tab.getObjectStatus() == NdbDictionary::Object::Retrieved); cols = tab.getNoOfColumns(); names = new char * [cols]; data = new NdbRecAttr * [cols]; for(int i = 0; igetName()); } ad[0] = attrib_delimiter; ad[1] = 0; m_ownData = false; } NDBT_ResultRow::~NDBT_ResultRow(){ for(int i = 0; iisNULL()){ sprintf(buf, "NULL"); str.append(buf); }else{ Uint32* p = (Uint32*)data[i]->aRef(); Uint32 sizeInBytes = data[i]->get_size_in_bytes(); for (Uint32 j = 0; j < sizeInBytes; j+=(sizeof(Uint32))){ str.append("H'"); if (j + 4 < sizeInBytes) { sprintf(buf, "%.8x", *p); } else { Uint32 tmp = 0; memcpy(&tmp, p, sizeInBytes - j); sprintf(buf, "%.8x", tmp); } p++; str.append(buf); if ((j + sizeof(Uint32)) < sizeInBytes) str.append(", "); } } str.append("\n"); } str.append("*"); //ndbout << "NDBT_ResultRow::c_str() = " << str.c_str() << endl; return str; } NdbOut & operator << (NdbOut& ndbout, const NDBT_ResultRow & res) { if (res.cols != 0) { ndbout << *(res.data[0]); for(int i = 1; im_ownData = true; Uint32 noOfColumns = m_table.getNoOfColumns(); for(Uint32 i = 0; i < noOfColumns; i++){ row->data[i] = data[i]->clone(); } return row; } bool NDBT_ResultRow::operator==(const NDBT_ResultRow& other) const { // quick and dirty return c_str() == other.c_str(); }