1 /* Copyright (C) 2014 InfiniDB, Inc.
2 
3    This program is free software; you can redistribute it and/or
4    modify it under the terms of the GNU General Public License
5    as published by the Free Software Foundation; version 2 of
6    the License.
7 
8    This program is distributed in the hope that it will be useful,
9    but WITHOUT ANY WARRANTY; without even the implied warranty of
10    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11    GNU General Public License for more details.
12 
13    You should have received a copy of the GNU General Public License
14    along with this program; if not, write to the Free Software
15    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16    MA 02110-1301, USA. */
17 
18 //  $Id: virtualtable.h 6370 2010-03-18 02:58:09Z xlou $
19 
20 
21 /** @file */
22 
23 #ifndef VIRTUAL_TABLE_H
24 #define VIRTUAL_TABLE_H
25 
26 #include "calpontsystemcatalog.h"
27 #include "returnedcolumn.h"
28 #include "simplecolumn.h"
29 
30 namespace joblist
31 {
32 
33 class VirtualTable
34 {
35 public:
36     VirtualTable();
~VirtualTable()37     virtual ~VirtualTable() {}
38 
39     virtual void initialize();
40     void addColumn(const execplan::SRCP& column);
41 
tableOid(const execplan::CalpontSystemCatalog::OID & oid)42     void tableOid(const execplan::CalpontSystemCatalog::OID& oid)
43     {
44         fTableOid = oid;
45     }
tableOid()46     const execplan::CalpontSystemCatalog::OID& tableOid() const
47     {
48         return fTableOid;
49     }
50 
name(const std::string & s)51     void name(const std::string& s)
52     {
53         fName = s;
54     }
name()55     const std::string& name() const
56     {
57         return fName;
58     }
59 
alias(const std::string & s)60     void alias(const std::string& s)
61     {
62         fAlias = s;
63     }
alias()64     const std::string& alias() const
65     {
66         return fAlias;
67     }
68 
view(const std::string & v)69     void view(const std::string& v)
70     {
71         fView = v;
72     }
view()73     const std::string& view() const
74     {
75         return fView;
76     }
77 
columns()78     const std::vector<execplan::SSC>& columns() const
79     {
80         return fColumns;
81     }
82     const execplan::CalpontSystemCatalog::OID& columnOid(uint32_t i) const;
83 
columnTypes()84     const std::vector<execplan::CalpontSystemCatalog::ColType>& columnTypes() const
85     {
86         return fColumnTypes;
87     }
88     void columnType(execplan::CalpontSystemCatalog::ColType& type, uint32_t i);
89     const execplan::CalpontSystemCatalog::ColType& columnType(uint32_t i) const;
90 
columnMap()91     const std::map<UniqId, uint32_t>& columnMap() const
92     {
93         return fColumnMap;
94     }
95 
varbinaryOK(bool b)96     void varbinaryOK(bool b)
97     {
98         fVarBinOK = b;
99     }
varbinaryOK()100     bool varbinaryOK() const
101     {
102         return fVarBinOK;
103     }
104 
105 protected:
106     execplan::CalpontSystemCatalog::OID fTableOid;
107     std::string                         fName;
108     std::string                         fAlias;
109     std::string                         fView;
110 
111     std::vector<execplan::SSC>          fColumns;
112     std::vector<execplan::CalpontSystemCatalog::ColType> fColumnTypes;
113     std::map<UniqId, uint32_t>          fColumnMap;
114 
115     bool                                fVarBinOK;
116 };
117 
118 }
119 
120 #endif  // VIRTUAL_TABLE_H
121 
122