CUBRID Engine  latest
load_common.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2008 Search Solution Corporation
3  * Copyright 2016 CUBRID Corporation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 /*
20  * load_common.cpp - common code used by loader
21  */
22 
23 #include "load_common.hpp"
24 
25 #include "dbtype_def.h"
26 #include "error_code.h"
27 #include "intl_support.h"
28 
29 #include <fstream>
30 
32 namespace cubload
33 {
34 
35  /*
36  * A wrapper function for calling batch handler. Used by split function and does some extra checks
37  */
38  int handle_batch (batch_handler &handler, class_id clsid, std::string &batch_content, batch_id &batch_id,
39  int64_t line_offset, int64_t &rows);
40 
41  /*
42  * Check if a given string starts with a given prefix
43  */
44  bool starts_with (const std::string &str, const std::string &prefix);
45 
46  /*
47  * Check if a given string ends with a given suffix
48  */
49  bool ends_with (const std::string &str, const std::string &suffix);
50 
51  /*
52  * Trim whitespaces on the right of the string. String is passed as reference and it will be modified
53  */
54  void rtrim (std::string &str);
55 }
56 
58 namespace cubload
59 {
60 
62  : m_id (NULL_BATCH_ID)
63  , m_clsid (NULL_CLASS_ID)
64  , m_content ()
65  , m_line_offset (0)
66  , m_rows (0)
67  {
68  //
69  }
70 
71  batch::batch (batch_id id, class_id clsid, std::string &content, int64_t line_offset, int64_t rows)
72  : m_id (id)
73  , m_clsid (clsid)
74  , m_content (std::move (content))
75  , m_line_offset (line_offset)
76  , m_rows (rows)
77  {
78  //
79  }
80 
81  batch::batch (batch &&other) noexcept
82  : m_id (other.m_id)
83  , m_clsid (other.m_clsid)
84  , m_content (std::move (other.m_content))
86  , m_rows (other.m_rows)
87  {
88  //
89  }
90 
91  batch &
92  batch::operator= (batch &&other) noexcept
93  {
94  m_id = other.m_id;
95  m_clsid = other.m_clsid;
96  m_content = std::move (other.m_content);
97  m_line_offset = other.m_line_offset;
98  m_rows = other.m_rows;
99 
100  return *this;
101  }
102 
103  batch_id
104  batch::get_id () const
105  {
106  return m_id;
107  }
108 
109  class_id
111  {
112  return m_clsid;
113  }
114 
115  int64_t
117  {
118  return m_line_offset;
119  }
120 
121  const std::string &
123  {
124  return m_content;
125  }
126 
127  int64_t
129  {
130  return m_rows;
131  }
132 
133  void
134  batch::pack (cubpacking::packer &serializator) const
135  {
136  serializator.pack_bigint (m_id);
137  serializator.pack_int (m_clsid);
138  serializator.pack_string (m_content);
139  serializator.pack_bigint (m_line_offset);
140  serializator.pack_bigint (m_rows);
141  }
142 
143  void
145  {
146  deserializator.unpack_bigint (m_id);
147  deserializator.unpack_int (m_clsid);
148  deserializator.unpack_string (m_content);
149  deserializator.unpack_bigint (m_line_offset);
150  deserializator.unpack_bigint (m_rows);
151  }
152 
153  size_t
154  batch::get_packed_size (cubpacking::packer &serializator, std::size_t start_offset) const
155  {
156  size_t size = serializator.get_packed_bigint_size (start_offset); // m_id
157  size += serializator.get_packed_int_size (size); // m_clsid
158  size += serializator.get_packed_string_size (m_content, size);
159  size += serializator.get_packed_bigint_size (size); // m_line_offset
160  size += serializator.get_packed_bigint_size (size); // m_rows
161 
162  return size;
163  }
164 
166  : volume ()
167  , input_file ()
168  , user_name ()
169  , password ()
170  , syntax_check (false)
171  , load_only (false)
172  , estimated_size (0)
173  , verbose (false)
174  , disable_statistics (false)
175  , periodic_commit (0)
176  , verbose_commit (false)
177  , no_oid_hint (false)
178  , schema_file ()
179  , index_file ()
180  , object_file ()
181  , error_file ()
182  , ignore_logging (false)
183  , compare_storage_order (false)
184  , table_name ()
185  , ignore_class_file ()
186  , ignore_classes ()
187  , m_ignored_errors ()
188  {
189  //
190  }
191 
192  void
193  load_args::pack (cubpacking::packer &serializator) const
194  {
195  serializator.pack_string (volume);
196  serializator.pack_string (input_file);
197  serializator.pack_string (user_name);
198  serializator.pack_string (password);
199  serializator.pack_bool (syntax_check);
200  serializator.pack_bool (load_only);
201  serializator.pack_int (estimated_size);
202  serializator.pack_bool (verbose);
203  serializator.pack_bool (disable_statistics);
204  serializator.pack_int (periodic_commit);
205  serializator.pack_bool (verbose_commit);
206  serializator.pack_bool (no_oid_hint);
207  serializator.pack_string (schema_file);
208  serializator.pack_string (index_file);
209  serializator.pack_string (object_file);
210  serializator.pack_string (error_file);
211  serializator.pack_bool (ignore_logging);
212  serializator.pack_bool (compare_storage_order);
213  serializator.pack_string (table_name);
214  serializator.pack_string (ignore_class_file);
215 
216  serializator.pack_bigint (ignore_classes.size ());
217  for (const std::string &ignore_class : ignore_classes)
218  {
219  serializator.pack_string (ignore_class);
220  }
221  serializator.pack_bigint (m_ignored_errors.size ());
222  for (const int error : m_ignored_errors)
223  {
224  serializator.pack_int (error);
225  }
226  }
227 
228  void
230  {
231  deserializator.unpack_string (volume);
232  deserializator.unpack_string (input_file);
233  deserializator.unpack_string (user_name);
234  deserializator.unpack_string (password);
235  deserializator.unpack_bool (syntax_check);
236  deserializator.unpack_bool (load_only);
237  deserializator.unpack_int (estimated_size);
238  deserializator.unpack_bool (verbose);
239  deserializator.unpack_bool (disable_statistics);
240  deserializator.unpack_int (periodic_commit);
241  deserializator.unpack_bool (verbose_commit);
242  deserializator.unpack_bool (no_oid_hint);
243  deserializator.unpack_string (schema_file);
244  deserializator.unpack_string (index_file);
245  deserializator.unpack_string (object_file);
246  deserializator.unpack_string (error_file);
247  deserializator.unpack_bool (ignore_logging);
248  deserializator.unpack_bool (compare_storage_order);
249  deserializator.unpack_string (table_name);
250  deserializator.unpack_string (ignore_class_file);
251 
252  size_t ignore_classes_size = 0;
253  deserializator.unpack_bigint (ignore_classes_size);
254  ignore_classes.reserve (ignore_classes_size);
255 
256  for (size_t i = 0; i < ignore_classes_size; ++i)
257  {
258  std::string ignore_class;
259  deserializator.unpack_string (ignore_class);
260  ignore_classes.push_back (ignore_class);
261  }
262  size_t ignore_errors_size = 0;
263 
264  deserializator.unpack_bigint (ignore_errors_size);
265  m_ignored_errors.resize (ignore_errors_size);
266  for (size_t i = 0; i < ignore_errors_size; i++)
267  {
268  deserializator.unpack_int (m_ignored_errors[i]);
269  }
270  }
271 
272  size_t
273  load_args::get_packed_size (cubpacking::packer &serializator, std::size_t start_offset) const
274  {
275  size_t size = serializator.get_packed_string_size (volume, start_offset);
276  size += serializator.get_packed_string_size (input_file, size);
277  size += serializator.get_packed_string_size (user_name, size);
278  size += serializator.get_packed_string_size (password, size);
279  size += serializator.get_packed_bool_size (size); // syntax_check
280  size += serializator.get_packed_bool_size (size); // load_only
281  size += serializator.get_packed_int_size (size); // estimated_size
282  size += serializator.get_packed_bool_size (size); // verbose
283  size += serializator.get_packed_bool_size (size); // disable_statistics
284  size += serializator.get_packed_int_size (size); // periodic_commit
285  size += serializator.get_packed_bool_size (size); // verbose_commit
286  size += serializator.get_packed_bool_size (size); // no_oid_hint
287  size += serializator.get_packed_string_size (schema_file, size);
288  size += serializator.get_packed_string_size (index_file, size);
289  size += serializator.get_packed_string_size (object_file, size);
290  size += serializator.get_packed_string_size (error_file, size);
291  size += serializator.get_packed_bool_size (size); // ignore_logging
292  size += serializator.get_packed_bool_size (size); // compare_storage_order
293  size += serializator.get_packed_string_size (table_name, size);
294  size += serializator.get_packed_string_size (ignore_class_file, size);
295 
296  size += serializator.get_packed_bigint_size (size); // ignore_classes size
297  for (const std::string &ignore_class : ignore_classes)
298  {
299  size += serializator.get_packed_string_size (ignore_class, size);
300  }
301 
302  size += serializator.get_packed_bigint_size (size);
303  for (const int i : m_ignored_errors)
304  {
305  size += serializator.get_packed_int_size (size);
306  }
307 
308  return size;
309  }
310 
311  int
313  {
314  if (ignore_class_file.empty ())
315  {
316  // it means that ignore class file was not provided, just exit without error
317  return NO_ERROR;
318  }
319 
320  std::ifstream file (ignore_class_file, std::fstream::in);
321  if (!file)
322  {
323  return ER_FILE_UNKNOWN_FILE;
324  }
325 
326  for (std::string line; std::getline (file, line);)
327  {
328  rtrim (line);
329  if (line.size () > DB_MAX_IDENTIFIER_LENGTH)
330  {
331  file.close ();
332  ignore_classes.clear ();
333  return ER_FAILED;
334  }
335 
336  const char *fmt= "%s";
337  std::string class_name (line.size (), '\0');
338 
339  // scan first string, and ignore rest of the line
340  sscanf (line.c_str (), fmt, class_name.c_str ());
341 
342  char lower_case_string[DB_MAX_IDENTIFIER_LENGTH] = { 0 };
343 
345 
346  // Make the string to be lower case and take into consideration all types of characters.
347  intl_identifier_lower (class_name.c_str (), lower_case_string);
348 
349  ignore_classes.emplace_back (lower_case_string);
350  }
351 
352  file.close ();
353  return NO_ERROR;
354  }
355 
357  : next (NULL)
358  , last (NULL)
359  , val (NULL)
360  , size (0)
361  , need_free_val (false)
362  {
363  //
364  }
365 
367  {
368  destroy ();
369  }
370 
371  string_type::string_type (char *val, std::size_t size, bool need_free_val)
372  : next (NULL)
373  , last (NULL)
374  , val (val)
375  , size (size)
376  , need_free_val (need_free_val)
377  {
378  //
379  }
380 
381  void
383  {
384  if (need_free_val)
385  {
386  delete [] val;
387 
388  val = NULL;
389  size = 0;
390  need_free_val = false;
391  }
392  }
393 
395  : id_name (id_name)
396  , arg_list (arg_list)
397  {
398  //
399  }
400 
402  constructor_spec_type *ctor_spec)
403  : attr_type ((attribute_type) attr_type)
404  , attr_list (attr_list)
405  , ctor_spec (ctor_spec)
406  {
407  //
408  }
409 
411  : next (NULL)
412  , last (NULL)
413  , val (NULL)
414  , type (LDR_NULL)
415  {
416  //
417  }
418 
420  : next (NULL)
421  , last (NULL)
422  , val (val)
423  , type (type)
424  {
425  //
426  }
427 
429  : class_id (class_id)
430  , class_name (class_name)
431  , instance_number (NULL)
432  {
433  //
434  }
435 
436  monetary_type::monetary_type (string_type *amount, int currency_type)
437  : amount (amount)
438  , currency_type (currency_type)
439  {
440  //
441  }
442 
444  : rows_committed (0)
445  , current_line {0}
446  , last_committed_line (0)
447  , rows_failed (0)
448  , error_message ()
449  , log_message ()
450  {
451  //
452  }
453 
454  // Copy constructor
455  stats::stats (const stats &copy)
457  , current_line {copy.current_line.load ()}
458  , last_committed_line (copy.last_committed_line)
459  , rows_failed (copy.rows_failed)
460  , error_message (copy.error_message)
461  , log_message (copy.log_message)
462  {
463  //
464  }
465 
466  stats &
467  stats::operator= (const stats &other)
468  {
469  this->rows_committed = other.rows_committed;
470  this->current_line.store (other.current_line.load ());
472  this->rows_failed = other.rows_failed;
473  this->error_message = other.error_message;
474  this->log_message = other.log_message;
475 
476  return *this;
477  }
478 
479  void
481  {
482  rows_committed = 0;
483  current_line.store (0);
485  rows_failed = 0;
486  error_message.clear ();
487  log_message.clear ();
488  }
489 
490  void
491  stats::pack (cubpacking::packer &serializator) const
492  {
493  serializator.pack_bigint (rows_committed);
494  serializator.pack_bigint (current_line.load ());
495  serializator.pack_bigint (last_committed_line);
496  serializator.pack_int (rows_failed);
497  serializator.pack_string (error_message);
498  serializator.pack_string (log_message);
499  }
500 
501  void
503  {
504  deserializator.unpack_bigint (rows_committed);
505 
506  int64_t current_line_;
507  deserializator.unpack_bigint (current_line_);
508  current_line.store (current_line_);
509 
510  deserializator.unpack_bigint (last_committed_line);
511  deserializator.unpack_int (rows_failed);
512  deserializator.unpack_string (error_message);
513  deserializator.unpack_string (log_message);
514  }
515 
516  size_t
517  stats::get_packed_size (cubpacking::packer &serializator, std::size_t start_offset) const
518  {
519  size_t size = serializator.get_packed_bigint_size (start_offset); // rows_committed
520  size += serializator.get_packed_bigint_size (size); // current_line
521  size += serializator.get_packed_bigint_size (size); // last_committed_line
522  size += serializator.get_packed_int_size (size); // rows_failed
523  size += serializator.get_packed_string_size (error_message, size);
524  size += serializator.get_packed_string_size (log_message, size);
525 
526  return size;
527  }
528 
530  : m_load_completed (false)
531  , m_load_failed (false)
532  , m_load_stats ()
533  {
534  }
535 
536  load_status::load_status (bool load_completed, bool load_failed, std::vector<stats> &load_stats)
537  : m_load_completed (load_completed)
538  , m_load_failed (load_failed)
539  , m_load_stats (load_stats)
540  {
541  }
542 
545  , m_load_failed (other.m_load_failed)
546  , m_load_stats (std::move (other.m_load_stats))
547  {
548  }
549 
550  load_status &
552  {
553  m_load_completed = other.m_load_completed;
554  m_load_failed = other.m_load_failed;
555  m_load_stats = std::move (other.m_load_stats);
556 
557  return *this;
558  }
559 
560  bool
562  {
563  return m_load_completed;
564  }
565 
566  bool
568  {
569  return m_load_failed;
570  }
571 
572  std::vector<stats> &
574  {
575  return m_load_stats;
576  }
577 
578  void
579  load_status::pack (cubpacking::packer &serializator) const
580  {
581  serializator.pack_bool (m_load_completed);
582  serializator.pack_bool (m_load_failed);
583 
584  serializator.pack_bigint (m_load_stats.size ());
585  for (const stats &s : m_load_stats)
586  {
587  s.pack (serializator);
588  }
589  }
590 
591  void
593  {
594  deserializator.unpack_bool (m_load_completed);
595  deserializator.unpack_bool (m_load_failed);
596 
597  size_t load_stats_size = 0;
598  deserializator.unpack_bigint (load_stats_size);
599  m_load_stats.resize (load_stats_size);
600 
601  for (size_t i = 0; i < load_stats_size; ++i)
602  {
603  m_load_stats[i].unpack (deserializator);
604  }
605  }
606 
607  size_t
608  load_status::get_packed_size (cubpacking::packer &serializator, std::size_t start_offset) const
609  {
610  size_t size = serializator.get_packed_bool_size (start_offset); // m_load_completed
611  size += serializator.get_packed_bool_size (size); // m_load_failed
612  size += serializator.get_packed_bigint_size (size); // m_load_stats size
613  for (const stats &s : m_load_stats)
614  {
615  size += s.get_packed_size (serializator, size);
616  }
617 
618  return size;
619  }
620 
621  int
622  split (int batch_size, const std::string &object_file_name, class_handler &c_handler, batch_handler &b_handler)
623  {
624  int error_code;
625  int64_t batch_rows = 0;
626  int lineno = 0;
627  int batch_start_offset = 0;
628  class_id clsid = FIRST_CLASS_ID;
630  std::string batch_buffer;
631  bool class_is_ignored = false;
632  short single_quote_checker = 0;
633 
634  if (object_file_name.empty ())
635  {
636  return ER_FILE_UNKNOWN_FILE;
637  }
638 
639  std::ifstream object_file (object_file_name, std::fstream::in | std::fstream::binary);
640  if (!object_file)
641  {
642  // file does not exists
643  return ER_FILE_UNKNOWN_FILE;
644  }
645 
646  assert (batch_size > 0);
647 
648  for (std::string line; std::getline (object_file, line); ++lineno)
649  {
650  bool is_id_line = starts_with (line, "%id") || starts_with (line, "%ID");
651  bool is_class_line = starts_with (line, "%class") || starts_with (line, "%CLASS");
652 
653  if (is_id_line || is_class_line)
654  {
655  if (is_class_line)
656  {
657  // in case of class line collect remaining for current class
658  // and start new batch for the new class
659 
660  error_code = handle_batch (b_handler, clsid, batch_buffer, batch_id, batch_start_offset, batch_rows);
661  if (error_code != NO_ERROR)
662  {
663  object_file.close ();
664  return error_code;
665  }
666 
667  ++clsid;
668  }
669 
670  // New class so we check if the previous one was ignored.
671  // If so, then we should empty the current batch since we do not send it to the server.
672 
673  line.append ("\n"); // feed lexer with new line
674  batch c_batch (batch_id, clsid, line, lineno, 1);
675  error_code = c_handler (c_batch, class_is_ignored);
676  if (error_code != NO_ERROR)
677  {
678  object_file.close ();
679  return error_code;
680  }
681 
682  // Next batch should start from the following line.
683  batch_start_offset = lineno + 1;
684  continue;
685  }
686 
687  if (class_is_ignored)
688  {
689  // Skip the remaining lines until we find another class.
690  continue;
691  }
692 
693  // strip trailing whitespace
694  rtrim (line);
695 
696  if (line.empty ())
697  {
698  continue;
699  }
700 
701  // it is a line containing row data so append it
702  batch_buffer.append (line);
703 
704  // since std::getline eats end line character, add it back in order to make loaddb lexer happy
705  batch_buffer.append ("\n");
706 
707  // check for matching single quotes
708  for (const char &c: line)
709  {
710  if (c == '\'')
711  {
712  single_quote_checker ^= 1;
713  }
714  }
715 
716  // it could be that a row is wrapped on the next line,
717  // this means that the row ends on the last line that does not end with '+' (plus) character
718  if (ends_with (line, "+"))
719  {
720  continue;
721  }
722 
723  // if single_quote_checker is 1, it means that a single quote was opened but not closed
724  if (single_quote_checker == 1)
725  {
726  continue;
727  }
728 
729  ++batch_rows;
730 
731  // check if we have a full batch
732  if (batch_rows == batch_size)
733  {
734  error_code = handle_batch (b_handler, clsid, batch_buffer, batch_id, batch_start_offset, batch_rows);
735  // Next batch should start from the following line.
736  batch_start_offset = lineno + 1;
737  if (error_code != NO_ERROR)
738  {
739  object_file.close ();
740  return error_code;
741  }
742  }
743  }
744 
745  // collect remaining rows
746  error_code = handle_batch (b_handler, clsid, batch_buffer, batch_id, batch_start_offset, batch_rows);
747 
748  object_file.close ();
749 
750  return error_code;
751  }
752 
753  int
754  handle_batch (batch_handler &handler, class_id clsid, std::string &batch_content, batch_id &batch_id, int64_t line_offset,
755  int64_t &rows)
756  {
757  if (batch_content.empty ())
758  {
759  // batch is empty, therefore do nothing and return
760  return NO_ERROR;
761  }
762 
763  batch batch_ (++batch_id, clsid, batch_content, line_offset, rows);
764  int error_code = handler (batch_);
765 
766  // prepare to start new batch for the class
767  batch_content.clear ();
768  rows = 0;
769 
770  return error_code;
771  }
772 
773  inline bool
774  starts_with (const std::string &str, const std::string &prefix)
775  {
776  return str.size () >= prefix.size () && 0 == str.compare (0, prefix.size (), prefix);
777  }
778 
779  inline bool
780  ends_with (const std::string &str, const std::string &suffix)
781  {
782  return str.size () >= suffix.size () && 0 == str.compare (str.size () - suffix.size (), suffix.size (), suffix);
783  }
784 
785  inline void
786  rtrim (std::string &str)
787  {
788  str.erase (str.find_last_not_of (" \t\f\v\n\r") + 1);
789  }
790 
791 } // namespace cubload
size_t get_packed_string_size(const std::string &str, const size_t curr_offset)
Definition: packer.cpp:593
void rtrim(std::string &str)
std::string error_file
stats & operator=(const stats &other)
#define NO_ERROR
Definition: error_code.h:46
int split(int batch_size, const std::string &object_file_name, class_handler &c_handler, batch_handler &b_handler)
void pack(cubpacking::packer &serializator) const override
#define ER_FILE_UNKNOWN_FILE
Definition: error_code.h:90
void pack_int(const int value)
Definition: packer.cpp:101
int64_t get_rows_number() const
void unpack_bigint(std::int64_t &value)
Definition: packer.cpp:247
std::string error_message
std::string object_file
string_type * last
#define ER_FAILED
Definition: error_code.h:47
void unpack(cubpacking::unpacker &deserializator) override
std::string ignore_class_file
std::string input_file
Definition: load_common.hpp:94
std::string m_content
Definition: load_common.hpp:72
std::string index_file
constant_type * last
batch & operator=(batch &&other) noexcept
Definition: load_common.cpp:92
int intl_identifier_lower(const char *src, char *dst)
size_t get_packed_int_size(size_t curr_offset)
Definition: packer.cpp:95
class_id m_clsid
Definition: load_common.hpp:71
void pack(cubpacking::packer &serializator) const override
std::string log_message
void unpack_string(std::string &str)
Definition: packer.cpp:619
std::atomic< int64_t > current_line
#define assert(x)
std::string table_name
const batch_id NULL_BATCH_ID
Definition: load_common.hpp:43
std::function< int64_t(const batch &)> batch_handler
Definition: load_common.hpp:77
#define DB_MAX_IDENTIFIER_LENGTH
Definition: dbtype_def.h:495
size_t get_packed_bool_size(size_t curr_offset)
Definition: packer.cpp:148
void unpack(cubpacking::unpacker &deserializator) override
const class_id FIRST_CLASS_ID
Definition: load_common.hpp:44
size_t get_packed_size(cubpacking::packer &serializator, std::size_t start_offset) const override
void pack(cubpacking::packer &serializator) const override
std::vector< stats > & get_load_stats()
#define NULL
Definition: freelistheap.h:34
load_status & operator=(load_status &&other) noexcept
std::vector< stats > m_load_stats
int64_t last_committed_line
void unpack_bool(bool &value)
Definition: packer.cpp:172
int64_t batch_id
Definition: load_common.hpp:39
const std::string & get_content() const
void pack_bool(bool value)
Definition: packer.cpp:154
string_type * next
std::string schema_file
static void error(const char *msg)
Definition: gencat.c:331
int64_t get_line_offset() const
size_t get_packed_size(cubpacking::packer &serializator, std::size_t start_offset) const override
int intl_identifier_lower_string_size(const char *src)
void unpack_int(int &value)
Definition: packer.cpp:123
std::string user_name
Definition: load_common.hpp:95
void pack_bigint(const std::int64_t &value)
Definition: packer.cpp:237
bool starts_with(const std::string &str, const std::string &prefix)
size_t get_packed_size(cubpacking::packer &serializator, std::size_t start_offset) const override
const class_id NULL_CLASS_ID
Definition: load_common.hpp:42
bool ends_with(const std::string &str, const std::string &suffix)
void pack_string(const std::string &str)
Definition: packer.cpp:599
void pack(cubpacking::packer &serializator) const override
std::function< int64_t(const batch &, bool &)> class_handler
Definition: load_common.hpp:78
int i
Definition: dynamic_load.c:954
int64_t m_line_offset
Definition: load_common.hpp:73
class_id get_class_id() const
int64_t rows_committed
std::vector< std::string > ignore_classes
size_t get_packed_size(cubpacking::packer &serializator, std::size_t start_offset) const override
constant_type * next
batch_id get_id() const
std::string volume
Definition: load_common.hpp:93
void unpack(cubpacking::unpacker &deserializator) override
int handle_batch(batch_handler &handler, class_id clsid, std::string &batch_content, batch_id &batch_id, int64_t line_offset, int64_t &rows)
int class_id
Definition: load_common.hpp:40
size_t get_packed_bigint_size(size_t curr_offset)
Definition: packer.cpp:231
std::string password
Definition: load_common.hpp:96
std::vector< int > m_ignored_errors
void unpack(cubpacking::unpacker &deserializator) override