mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / storage / ndb / tools / restore / consumer_printer.cpp
blobee52d14fe7633360d79855a45ecf432f526f3c6f
1 /* Copyright (c) 2003-2007 MySQL AB
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; version 2 of the License.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software
14 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
16 #include "consumer_printer.hpp"
17 extern FilteredNdbOut info;
18 extern NdbRecordPrintFormat g_ndbrecord_print_format;
19 extern const char *tab_path;
21 bool
22 BackupPrinter::table(const TableS & tab)
24 if (m_print || m_print_meta)
26 m_ndbout << tab;
27 info.setLevel(254);
28 info << "Successfully printed table: ", tab.m_dictTable->getName();
30 return true;
33 void
34 BackupPrinter::tuple(const TupleS & tup, Uint32 fragId)
36 m_dataCount++;
37 if (m_print || m_print_data)
39 if (m_ndbout.m_out == info.m_out)
41 info.setLevel(254);
42 info << tup.getTable()->getTableName() << "; ";
44 m_ndbout << tup << g_ndbrecord_print_format.lines_terminated_by;
48 void
49 BackupPrinter::logEntry(const LogEntry & logE)
51 if (m_print || m_print_log)
52 m_ndbout << logE << endl;
53 m_logCount++;
56 void
57 BackupPrinter::endOfLogEntrys()
59 if (m_print || m_print_log)
61 info.setLevel(254);
62 info << "Printed " << m_dataCount << " tuples and "
63 << m_logCount << " log entries"
64 << " to stdout." << endl;
67 bool
68 BackupPrinter::update_apply_status(const RestoreMetaData &metaData)
70 if (m_print)
73 return true;