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: passthrucommand-jl.cpp 9655 2013-06-25 23:08:13Z xlou $
20 // C++ Implementation: passthrucommand-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 <string>
32 #include <sstream>
33 using namespace std;
34
35 #include "bytestream.h"
36 using namespace messageqcpp;
37
38 #include "primitivestep.h"
39 #include "tablecolumn.h"
40 #include "command-jl.h"
41 #include "passthrucommand-jl.h"
42
43 namespace joblist
44 {
45
46 /* I think this class literally does nothing */
47
PassThruCommandJL(const PassThruStep & p)48 PassThruCommandJL::PassThruCommandJL(const PassThruStep& p)
49 {
50 OID = p.oid();
51 colName = p.name();
52 colWidth = p.colWidth;
53
54 // cout << "PassThru col width = " << (int) colWidth << " for OID " << OID << endl;
55 /* Is this ever a dictionary column? */
56 if (p.isDictColumn)
57 tableColumnType = TableColumn::STRING;
58 else
59 switch (colWidth)
60 {
61 case 1:
62 tableColumnType = TableColumn::UINT8;
63 break;
64
65 case 2:
66 tableColumnType = TableColumn::UINT16;
67 break;
68
69 case 4:
70 tableColumnType = TableColumn::UINT32;
71 break;
72
73 case 8:
74 tableColumnType = TableColumn::UINT64;
75 break;
76
77 default:
78 throw logic_error("PassThruCommandJL(): bad column width?");
79 }
80 }
81
~PassThruCommandJL()82 PassThruCommandJL::~PassThruCommandJL()
83 {
84 }
85
setLBID(uint64_t l,uint32_t dbroot)86 void PassThruCommandJL::setLBID(uint64_t l, uint32_t dbroot)
87 {
88 }
89
createCommand(ByteStream & bs) const90 void PassThruCommandJL::createCommand(ByteStream& bs) const
91 {
92 bs << (uint8_t) PASS_THRU;
93 bs << colWidth;
94 CommandJL::createCommand(bs);
95 }
96
runCommand(ByteStream & bs) const97 void PassThruCommandJL::runCommand(ByteStream& bs) const
98 {
99 }
100
getTableColumnType()101 uint8_t PassThruCommandJL::getTableColumnType()
102 {
103 return tableColumnType;
104 }
105
toString()106 string PassThruCommandJL::toString()
107 {
108 ostringstream oss;
109 oss << "PassThruCommandJL: colwidth=" << static_cast<uint32_t>(colWidth) << " oid=" << OID
110 << " colName=" << colName;
111 return oss.str();
112 }
113
getWidth()114 uint16_t PassThruCommandJL::getWidth()
115 {
116 return colWidth;
117 }
118
119 };
120 // vim:ts=4 sw=4:
121
122