1 /*
2    Copyright (c) 2004, 2021, Oracle and/or its affiliates.
3     All rights reserved. Use is subject to license terms.
4 
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License, version 2.0,
7    as published by the Free Software Foundation.
8 
9    This program is also distributed with certain software (including
10    but not limited to OpenSSL) that is licensed under separate terms,
11    as designated in a particular file or component or in included license
12    documentation.  The authors of MySQL hereby grant you an additional
13    permission to link the program and your derivative works with the
14    separately licensed software that they have included with MySQL.
15 
16    This program is distributed in the hope that it will be useful,
17    but WITHOUT ANY WARRANTY; without even the implied warranty of
18    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19    GNU General Public License, version 2.0, for more details.
20 
21    You should have received a copy of the GNU General Public License
22    along with this program; if not, write to the Free Software
23    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
24 */
25 
26 #include "consumer_printer.hpp"
27 extern FilteredNdbOut info;
28 extern bool ga_dont_ignore_systab_0;
29 extern NdbRecordPrintFormat g_ndbrecord_print_format;
30 extern const char *tab_path;
31 
32 bool
table(const TableS & tab)33 BackupPrinter::table(const TableS & tab)
34 {
35   if (m_print || m_print_meta)
36   {
37     m_ndbout << tab;
38     info.setLevel(254);
39     info << "Successfully printed table: ", tab.m_dictTable->getName();
40   }
41   return true;
42 }
43 
44 void
tuple(const TupleS & tup,Uint32 fragId)45 BackupPrinter::tuple(const TupleS & tup, Uint32 fragId)
46 {
47   m_dataCount++;
48   if (m_print || m_print_data)
49   {
50     if (m_ndbout.m_out == info.m_out)
51     {
52       info.setLevel(254);
53       info << tup.getTable()->getTableName() << "; ";
54     }
55     const TableS * table = tup.getTable();
56     if ((!ga_dont_ignore_systab_0) &&  table->isSYSTAB_0())
57       return;
58     m_ndbout << tup << g_ndbrecord_print_format.lines_terminated_by;
59   }
60 }
61 
62 void
logEntry(const LogEntry & logE)63 BackupPrinter::logEntry(const LogEntry & logE)
64 {
65   if (m_print || m_print_log)
66     m_ndbout << logE << endl;
67   m_logCount++;
68 }
69 
70 void
endOfLogEntrys()71 BackupPrinter::endOfLogEntrys()
72 {
73   if (m_print || m_print_log)
74   {
75     info.setLevel(254);
76     info << "Printed " << m_dataCount << " tuples and "
77          << m_logCount << " log entries"
78          << " to stdout." << endl;
79   }
80 }
81 bool
update_apply_status(const RestoreMetaData & metaData)82 BackupPrinter::update_apply_status(const RestoreMetaData &metaData)
83 {
84   if (m_print)
85   {
86   }
87   return true;
88 }
89