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 //
19 // $Id: rtscommand-jl.cpp 9655 2013-06-25 23:08:13Z xlou $
20 // C++ Implementation: rtscommand-jl
21 //
22 // Description:
23 //
24 //
25 // Author: Patrick <pleblanc@localhost.localdomain>, (C) 2008
26 //
27 // Copyright: See COPYING file that comes with this distribution
28 //
29 //
30
31 #include "bpp-jl.h"
32 #include "tablecolumn.h"
33
34
35 using namespace std;
36 using namespace messageqcpp;
37
38 namespace joblist
39 {
40
RTSCommandJL(const pColStep & c,const pDictionaryStep & d)41 RTSCommandJL::RTSCommandJL(const pColStep& c, const pDictionaryStep& d)
42 {
43
44 col.reset(new ColumnCommandJL(c));
45 dict.reset(new DictStepJL(d));
46 /* XXXPAT: Need to validate the width; critical for tuple return functionality */
47 dict->setWidth(c.realWidth);
48 OID = d.oid();
49 colName = d.name();
50 passThru = 0;
51 }
52
RTSCommandJL(const PassThruStep & p,const pDictionaryStep & d)53 RTSCommandJL::RTSCommandJL(const PassThruStep& p, const pDictionaryStep& d)
54 {
55 execplan::CalpontSystemCatalog::ColType colType;
56
57 dict.reset(new DictStepJL(d));
58 /* XXXPAT: Need to validate the width; critical for tuple return functionality */
59 dict->setWidth(p.realWidth);
60 OID = d.oid();
61 colName = d.name();
62 passThru = 1;
63 }
64
~RTSCommandJL()65 RTSCommandJL::~RTSCommandJL()
66 {
67 }
68
setLBID(uint64_t data,uint32_t dbroot)69 void RTSCommandJL::setLBID(uint64_t data, uint32_t dbroot)
70 {
71 if (!passThru)
72 col->setLBID(data, dbroot);
73
74 dict->setLBID(data, dbroot);
75 }
76
createCommand(ByteStream & bs) const77 void RTSCommandJL::createCommand(ByteStream& bs) const
78 {
79 bs << (uint8_t) RID_TO_STRING;
80 bs << passThru;
81
82 if (!passThru)
83 col->createCommand(bs);
84
85 dict->createCommand(bs);
86 CommandJL::createCommand(bs);
87 }
88
runCommand(ByteStream & bs) const89 void RTSCommandJL::runCommand(ByteStream& bs) const
90 {
91 if (!passThru)
92 col->runCommand(bs);
93
94 dict->runCommand(bs);
95 }
96
getTableColumnType()97 uint8_t RTSCommandJL::getTableColumnType()
98 {
99 return TableColumn::STRING;
100 }
101
toString()102 string RTSCommandJL::toString()
103 {
104 ostringstream ret;
105
106 ret << "RTSCommandJL: oid=" << OID << " colName=" << colName << endl;
107 ret << " ";
108
109 if (!passThru)
110 ret << col->toString() << endl;
111
112 ret << " ";
113 ret << dict->toString();
114 return ret.str();
115 }
116
getWidth()117 uint16_t RTSCommandJL::getWidth()
118 {
119 return dict->getWidth();
120 }
121
122 };
123