GPUdb C++ API  Version 5.2.0.0
insert_records.h
Go to the documentation of this file.
1 /*
2  * This file was autogenerated by the GPUdb schema processor.
3  *
4  * DO NOT EDIT DIRECTLY.
5  */
6 #ifndef __INSERT_RECORDS_H__
7 #define __INSERT_RECORDS_H__
8 
9 namespace gpudb
10 {
11 
38  {
39 
45  tableName(std::string()),
46  list(std::vector<std::vector<uint8_t> >()),
47  listStr(std::vector<std::string>()),
48  listEncoding(std::string("binary")),
49  options(std::map<std::string, std::string>())
50  {
51  }
52 
92  RawInsertRecordsRequest(const std::string& tableName, const std::vector<std::vector<uint8_t> >& list, const std::map<std::string, std::string>& options):
93  tableName(tableName),
94  list(list),
95  listStr(std::vector<std::string>()),
96  listEncoding("binary"),
97  options(options)
98  {
99  }
100 
147  RawInsertRecordsRequest(const std::string& tableName, const std::vector<std::vector<uint8_t> >& list, const std::vector<std::string>& listStr, const std::string& listEncoding, const std::map<std::string, std::string>& options):
148  tableName(tableName),
149  list(list),
150  listStr(listStr),
151  listEncoding(listEncoding),
152  options(options)
153  {
154  }
155 
156  std::string tableName;
157  std::vector<std::vector<uint8_t> > list;
158  std::vector<std::string> listStr;
159  std::string listEncoding;
160  std::map<std::string, std::string> options;
161  };
162 }
163 
164 namespace avro
165 {
166  template<> struct codec_traits<gpudb::RawInsertRecordsRequest>
167  {
168  static void encode(Encoder& e, const gpudb::RawInsertRecordsRequest& v)
169  {
170  ::avro::encode(e, v.tableName);
171  ::avro::encode(e, v.list);
172  ::avro::encode(e, v.listStr);
173  ::avro::encode(e, v.listEncoding);
174  ::avro::encode(e, v.options);
175  }
176 
177  static void decode(Decoder& d, gpudb::RawInsertRecordsRequest& v)
178  {
179  if (::avro::ResolvingDecoder *rd = dynamic_cast< ::avro::ResolvingDecoder*>(&d))
180  {
181  const std::vector<size_t> fo = rd->fieldOrder();
182 
183  for (std::vector<size_t>::const_iterator it = fo.begin(); it != fo.end(); ++it)
184  {
185  switch (*it)
186  {
187  case 0:
188  ::avro::decode(d, v.tableName);
189  break;
190 
191  case 1:
192  ::avro::decode(d, v.list);
193  break;
194 
195  case 2:
196  ::avro::decode(d, v.listStr);
197  break;
198 
199  case 3:
200  ::avro::decode(d, v.listEncoding);
201  break;
202 
203  case 4:
204  ::avro::decode(d, v.options);
205  break;
206 
207  default:
208  break;
209  }
210  }
211  }
212  else
213  {
214  ::avro::decode(d, v.tableName);
215  ::avro::decode(d, v.list);
216  ::avro::decode(d, v.listStr);
217  ::avro::decode(d, v.listEncoding);
218  ::avro::decode(d, v.options);
219  }
220  }
221  };
222 }
223 
224 namespace gpudb
225 {
226 
255  template<typename T> struct InsertRecordsRequest
256  {
257 
263  tableName(std::string()),
264  data(std::vector<T>()),
265  options(std::map<std::string, std::string>())
266  {
267  }
268 
308  InsertRecordsRequest(const std::string& tableName, const std::vector<T>& data, const std::map<std::string, std::string>& options):
309  tableName(tableName),
310  data(data),
311  options(options)
312  {
313  }
314 
315  std::string tableName;
316  std::vector<T> data;
317  std::map<std::string, std::string> options;
318  };
319 }
320 
321 namespace gpudb
322 {
323 
350  {
351 
357  recordIds(std::vector<std::string>()),
358  countInserted(int32_t()),
359  countUpdated(int32_t())
360  {
361  }
362 
363  std::vector<std::string> recordIds;
364  int32_t countInserted;
365  int32_t countUpdated;
366  };
367 }
368 
369 namespace avro
370 {
371  template<> struct codec_traits<gpudb::InsertRecordsResponse>
372  {
373  static void encode(Encoder& e, const gpudb::InsertRecordsResponse& v)
374  {
375  ::avro::encode(e, v.recordIds);
376  ::avro::encode(e, v.countInserted);
377  ::avro::encode(e, v.countUpdated);
378  }
379 
380  static void decode(Decoder& d, gpudb::InsertRecordsResponse& v)
381  {
382  if (::avro::ResolvingDecoder *rd = dynamic_cast< ::avro::ResolvingDecoder*>(&d))
383  {
384  const std::vector<size_t> fo = rd->fieldOrder();
385 
386  for (std::vector<size_t>::const_iterator it = fo.begin(); it != fo.end(); ++it)
387  {
388  switch (*it)
389  {
390  case 0:
391  ::avro::decode(d, v.recordIds);
392  break;
393 
394  case 1:
395  ::avro::decode(d, v.countInserted);
396  break;
397 
398  case 2:
399  ::avro::decode(d, v.countUpdated);
400  break;
401 
402  default:
403  break;
404  }
405  }
406  }
407  else
408  {
409  ::avro::decode(d, v.recordIds);
410  ::avro::decode(d, v.countInserted);
411  ::avro::decode(d, v.countUpdated);
412  }
413  }
414  };
415 }
416 
417 #endif
InsertRecordsRequest(const std::string &tableName, const std::vector< T > &data, const std::map< std::string, std::string > &options)
Constructs an InsertRecordsRequest object with the specified parameters.
RawInsertRecordsRequest()
Constructs a RawInsertRecordsRequest object with default parameter values.
A set of output parameters for insertRecordsRaw(const RawInsertRecordsRequest&) const.
std::vector< std::string > listStr
std::vector< std::string > recordIds
InsertRecordsRequest()
Constructs an InsertRecordsRequest object with default parameter values.
RawInsertRecordsRequest(const std::string &tableName, const std::vector< std::vector< uint8_t > > &list, const std::map< std::string, std::string > &options)
Constructs a RawInsertRecordsRequest object with the specified parameters.
InsertRecordsResponse()
Constructs an InsertRecordsResponse object with default parameter values.
std::map< std::string, std::string > options
RawInsertRecordsRequest(const std::string &tableName, const std::vector< std::vector< uint8_t > > &list, const std::vector< std::string > &listStr, const std::string &listEncoding, const std::map< std::string, std::string > &options)
Constructs a RawInsertRecordsRequest object with the specified parameters.
A set of input parameters for insertRecordsRaw(const RawInsertRecordsRequest&) const.
std::vector< std::vector< uint8_t > > list
std::map< std::string, std::string > options
A set of input parameters for insertRecordsRaw(const RawInsertRecordsRequest&) const.