1 /* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
2 
3   This program is free software; you can redistribute it and/or modify
4   it under the terms of the GNU General Public License, version 2.0,
5   as published by the Free Software Foundation.
6 
7   This program is also distributed with certain software (including
8   but not limited to OpenSSL) that is licensed under separate terms,
9   as designated in a particular file or component or in included license
10   documentation.  The authors of MySQL hereby grant you an additional
11   permission to link the program and your derivative works with the
12   separately licensed software that they have included with MySQL.
13 
14   This program is distributed in the hope that it will be useful,
15   but WITHOUT ANY WARRANTY; without even the implied warranty of
16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   GNU General Public License, version 2.0, for more details.
18 
19   You should have received a copy of the GNU General Public License
20   along with this program; if not, write to the Free Software
21   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
22 */
23 
24 #ifndef NDBINFO_SCAN_VIRTUAL_HPP
25 #define NDBINFO_SCAN_VIRTUAL_HPP
26 
27 #include "NdbInfo.hpp"
28 #include "NdbInfoScanOperation.hpp"
29 
30 /*
31   Scan implementation for retrieving rows from a virtual
32   table (also known as "hardcoded").
33 */
34 class NdbInfoScanVirtual : public NdbInfoScanOperation {
35 public:
36   virtual int readTuples();
37 
38   virtual const class NdbInfoRecAttr* getValue(const char * anAttrName);
39   virtual const class NdbInfoRecAttr* getValue(Uint32 anAttrId);
40   virtual int execute();
41   virtual int nextResult();
42   virtual  ~NdbInfoScanVirtual();
43 
44   NdbInfoScanVirtual(const NdbInfo::Table* table,
45                      const class VirtualTable* virt);
46   int init();
47 
48   static bool create_virtual_tables(Vector<NdbInfo::Table*>& list);
49   static void delete_virtual_tables(Vector<NdbInfo::Table*>& list);
50 private:
51   enum State { Undefined, Initial, Prepared,
52                MoreData, End } m_state;
53 
54   const NdbInfo::Table* const m_table;
55   const class VirtualTable* const m_virt;
56 
57   friend class VirtualTable;
58   NdbInfoRecAttrCollection m_recAttrs;
59 
60   char* m_buffer;
61   size_t m_buffer_size;
62   Uint32 m_row_counter; // Current row
63 };
64 
65 #endif
66