SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
QuerySelect.cc
Go to the documentation of this file.
1 /*
2  * SWC-DB© Copyright since 2019 Alex Kashirin <kashirin.alex@gmail.com>
3  * License details at <https://github.com/kashirin-alex/swc-db/#license>
4  */
5 
6 
7 #include "swcdb/core/Time.h"
11 
12 
13 namespace SWC { namespace client { namespace SQL {
14 
15 namespace {
16 
17  static const char TOKEN_SELECT[] = "select";
18  static const uint8_t LEN_SELECT = 6;
19  static const char TOKEN_DUMP[] = "dump";
20  static const uint8_t LEN_DUMP = 4;
21  static const char TOKEN_WHERE[] = "where";
22  static const uint8_t LEN_WHERE = 5;
23  static const char TOKEN_COL[] = "col";
24  static const uint8_t LEN_COL = 3;
25  static const char TOKEN_CELLS[] = "cells";
26  static const uint8_t LEN_CELLS = 5;
27 
28 
29  static const char TOKEN_RANGE[] = "range";
30  static const uint8_t LEN_RANGE = 5;
31  static const char TOKEN_KEY[] = "key";
32  static const uint8_t LEN_KEY = 3;
33  static const char TOKEN_VALUE[] = "value";
34  static const uint8_t LEN_VALUE = 5;
35  static const char TOKEN_TIMESTAMP[] = "timestamp";
36  static const uint8_t LEN_TIMESTAMP = 9;
37  static const char TOKEN_OFFSET_KEY[] = "offset_key";
38  static const uint8_t LEN_OFFSET_KEY = 10;
39  static const char TOKEN_OFFSET_REV[] = "offset_rev";
40  static const uint8_t LEN_OFFSET_REV = 10;
41  static const char TOKEN_RANGE_END_REST[] = "range_end_rest";
42  static const uint8_t LEN_RANGE_END_REST = 14;
43 
44  static const char TOKEN_LIMIT[] = "limit";
45  static const uint8_t LEN_LIMIT = 5;
46  static const char TOKEN_OFFSET[] = "offset";
47  static const uint8_t LEN_OFFSET = 6;
48  static const char TOKEN_MAX_VERS[] = "max_versions";
49  static const uint8_t LEN_MAX_VERS = 12;
50  static const char TOKEN_MAX_BUFF[] = "max_buffer";
51  static const uint8_t LEN_MAX_BUFF = 10;
52  static const char TOKEN_ONLY_DELETES[] = "only_deletes";
53  static const uint8_t LEN_ONLY_DELETES = 12;
54  static const char TOKEN_ONLY_KEYS[] = "only_keys";
55  static const uint8_t LEN_ONLY_KEYS = 9;
56 
57  static const char TOKEN_DELETE_MATCHING[] = "delete_matching";
58  static const uint8_t LEN_DELETE_MATCHING = 15;
59 
60 }
61 
63  const std::string& a_sql, DB::Specs::Scan& a_specs,
64  std::string& a_message)
65  : Reader(a_sql, a_message),
66  clients(a_clients), specs(a_specs) {
67 }
68 
70 
71  bool token_cmd = false;
72  bool token_where = false;
73 
74  while(remain && !err && (!token_cmd || !token_where)) {
75  if(!token_cmd) {
76  expect_token(TOKEN_SELECT, LEN_SELECT, token_cmd);
77  continue;
78  }
79  if(!token_where) {
80  expect_token(TOKEN_WHERE, LEN_WHERE, token_where);
81  continue;
82  }
83  --remain;
84  ++ptr;
85  }
86 
87  if(remain && !err)
89 
90  if(remain && !err) {
92  if(specs.flags.was_set) {
93  // apply global-scope flags to cells_intervals
94  for(auto& col : specs.columns) {
95  for(auto& intval : col) {
96  if(!intval->flags.was_set)
97  intval->flags.copy(specs.flags);
98  }
99  }
100  }
101  }
102  return err;
103 }
104 
105 int QuerySelect::parse_dump(std::string& fs, std::string& filepath,
106  uint64_t& split_size,
107  std::string& ext, int& level) {
108  bool token_cmd = false;
109  bool token_col = false;
110 
111  seek_space();
112  expect_token(TOKEN_DUMP, LEN_DUMP, token_cmd);
113  if(err)
114  return err;
115  seek_space();
116  expect_token(TOKEN_COL, LEN_COL, token_col);
117  if(err)
118  return err;
119 
120  expect_eq();
121  if(err)
122  return err;
123  std::string buff;
124  read(buff);
125  if(!err && buff.empty())
126  error_msg(Error::SQL_PARSE_ERROR, "missing col 'id|name'");
127  if(err)
128  return err;
129  auto schema = add_column(buff);
130  if(err)
131  return err;
132 
133  bool into = false;
134  seek_space();
135  expect_token("into", 4, into);
136  if(err)
137  return err;
138 
139 
140  bool any = true;
141  while(any && remain && !err) {
142  if(found_space())
143  continue;
144 
145  if((any = found_token("fs", 2))) {
146  expect_eq();
147  if(err)
148  break;
149  read(fs);
150  if(!err && fs.empty())
151  error_msg(Error::SQL_PARSE_ERROR, "missing 'fs' value");
152  continue;
153  }
154 
155  if((any = found_token("path", 4))) {
156  expect_eq();
157  if(err)
158  break;
159  read(filepath);
160  continue;
161  }
162 
163  if((any = found_token("split", 5))) {
164  expect_eq();
165  if(err)
166  break;
167  std::string n;
168  read(n);
169  if(!err && n.empty())
170  error_msg(Error::SQL_PARSE_ERROR, "missing 'split' value");
171  if(err)
172  break;
173  try {
174  int64_t v;
176  split_size = v;
177  } catch(...) {
179  error_msg(e.code(), e.what());
180  }
181  continue;
182  }
183 
184  if((any = found_token("ext", 3))) {
185  expect_eq();
186  if(err)
187  break;
188  read(ext);
189  if(!err && ext.empty())
190  error_msg(Error::SQL_PARSE_ERROR, "missing 'ext' value");
191  continue;
192  }
193 
194  if((any = found_token("level", 5))) {
195  expect_eq();
196  if(err)
197  break;
198  uint32_t n;
199  bool was_set;
200  read_uint32_t(n, was_set);
201  if(!err)
202  level = n;
203  continue;
204  }
205  }
206  if(!err && filepath.empty())
207  error_msg(Error::SQL_PARSE_ERROR, "missing 'path'");
208  if(err)
209  return err;
210 
211  seek_space();
212  if(found_token(TOKEN_WHERE, LEN_WHERE)) {
213  DB::SchemasVec cols(1, schema);
214  read_cells_intervals(cols);
215 
216  for(auto& col : specs.columns)
217  if(!col.size()) {
218  error_msg(Error::SQL_PARSE_ERROR, "missing cells-intervals");
219  return err;
220  }
221 
222  } else {
223  for(auto& col : specs.columns)
224  col.emplace_back(DB::Specs::Interval::make_ptr());
225  }
226 
227  return err;
228 }
229 
230 void QuerySelect::parse_output_flags(uint8_t& output_flags) {
231  bool any = true;
232  while(any && remain && !err) {
233  if(found_space())
234  continue;
235 
236  if((any = found_token("OUTPUT_NO_TS", 12))) {
237  output_flags |= DB::OutputFlag::NO_TS;
238  continue;
239  }
240  if((any = found_token("OUTPUT_NO_VALUE", 15))) {
241  output_flags |= DB::OutputFlag::NO_VALUE;
242  continue;
243  }
244  if((any = found_token("OUTPUT_NO_ENCODE", 16))) {
245  output_flags |= DB::OutputFlag::NO_ENCODE;
246  continue;
247  }
248  }
249 }
250 
251 void QuerySelect::parse_display_flags(uint8_t& display_flags) {
252 
253  bool any = true;
254  while(any && remain && !err) {
255  if(found_space())
256  continue;
257 
258  if((any = found_token("DISPLAY_TIMESTAMP", 17))) {
259  display_flags |= DB::DisplayFlag::TIMESTAMP;
260  continue;
261  }
262  if((any = found_token("DISPLAY_DATETIME", 16))) {
263  display_flags |= DB::DisplayFlag::DATETIME;
264  continue;
265  }
266  if((any = found_token("DISPLAY_BINARY", 14))) {
267  display_flags |= DB::DisplayFlag::BINARY;
268  continue;
269  }
270  if((any = found_token("DISPLAY_SPECS", 13))) {
271  display_flags |= DB::DisplayFlag::SPECS;
272  continue;
273  }
274  if((any = found_token("DISPLAY_STATS", 13))) {
275  display_flags |= DB::DisplayFlag::STATS;
276  continue;
277  }
278  if((any = found_token("DISPLAY_COLUMN", 14))) {
279  display_flags |= DB::DisplayFlag::COLUMN;
280  continue;
281  }
282  }
283 }
284 
286  bool token_col = false;
287  bool bracket_round = false;
288  bool eq = false;
289  bool col_names_set = false;
290  bool processed = false;
291  bool possible_and = false;
292  DB::Schemas::SelectorPatterns schema_patterns;
293 
294  std::string col_name;
295  DB::SchemasVec cols;
296 
297  while(remain && !err) {
298  if(found_space())
299  continue;
300  if(possible_and) {
301  if(found_token(TOKEN_AND, LEN_AND))
302  possible_and = false;
303  else
304  break;
305  }
306 
307  if(!token_col) {
308  expect_token(TOKEN_COL, LEN_COL, token_col);
309  continue;
310  }
311 
312  if(token_col && !col_names_set) {
313  // "col(, 1 2 ,re"aa$, =^"Ds", "3 4", tags>=['1',>4,<'5'])"
314  // --> ["1","2", [patterns], "3 4", [tags]]
315  if(found_space())
316  continue;
317 
318  if(!bracket_round) {
319  expect_token("(", 1, bracket_round);
320  continue;
321  }
322 
323  if(found_char(','))
324  continue;
325 
326  if(found_char(')')) {
327  if(!schema_patterns.names.empty() ||
328  schema_patterns.tags.comp != Condition::NONE) {
329  add_column(schema_patterns, cols);
330  schema_patterns.names.clear();
331  schema_patterns.tags.clear();
332  }
333 
334  if(cols.empty()) {
335  error_msg(Error::SQL_PARSE_ERROR, "missing col 'id|name'");
336  break;
337  }
338  bracket_round = false;
339  col_names_set = true;
340  continue;
341 
342  } else if(remain <= 1) {
343  error_msg(Error::SQL_PARSE_ERROR, "missing ')'");
344  break;
345  }
346 
347  if(found_token("tags", 4)) {
348  read_column_tags(schema_patterns.tags);
349  continue;
350  }
351 
352  read_column(",)", col_name, schema_patterns.names);
353  if(!col_name.empty()) {
354  cols.push_back(add_column(col_name));
355  col_name.clear();
356  }
357  continue;
358  }
359 
360  if(col_names_set) {
361 
362  if(!processed) {
363 
364  if(!eq) {
365  expect_token("=", 1, eq);
366  continue;
367  }
368  if(!bracket_round) {
369  expect_token("(", 1, bracket_round);
370  continue;
371  }
372 
373  read_cells_intervals(cols);
374  cols.clear();
375 
376  bracket_round = false;
377  eq = false;
378  processed = true;
379  continue;
380  }
381 
382  if(!bracket_round) {
383  expect_token(")", 1, bracket_round);
384  continue;
385  }
386 
387  col_names_set = false;
388  bracket_round = false;
389  processed = false;
390  token_col = false;
391  possible_and = true;
392  }
393 
394  }
395 
396 }
397 
398 DB::Schema::Ptr QuerySelect::add_column(const std::string& col_str) {
399  auto schema = get_schema(clients, col_str);
400  if(err)
401  return nullptr;
402  for(auto& col : specs.columns) {
403  if(schema->cid == col.cid)
404  return schema;
405  }
406  specs.columns.emplace_back(schema->cid);
407  return schema;
408 }
409 
411  DB::SchemasVec& cols) {
412  auto schemas = get_schema(clients, patterns);
413  if(err)
414  return;
415 
416  for(auto& schema : schemas) {
417  auto it = specs.columns.cbegin();
418  for(; it != specs.columns.cend(); ++it) {
419  if(schema->cid == it->cid)
420  break;
421  }
422  if(it == specs.columns.cend())
423  specs.columns.emplace_back(schema->cid);
424  cols.push_back(schema);
425  }
426 }
427 
429  bool token_cells = false;
430  bool bracket_round = false;
431  bool eq = false;
432  bool processed = false;
433  bool possible_and = false;
434 
435  while(remain && !err) {
436  if(possible_and) {
437  if(found_space())
438  continue;
439  if(found_token(TOKEN_AND, LEN_AND))
440  possible_and = false;
441  else
442  break;
443  }
444  if(!token_cells) {
445  expect_token(TOKEN_CELLS, LEN_CELLS, token_cells);
446  continue;
447  }
448 
449  if(!processed) {
450 
451  if(!eq) {
452  expect_token("=", 1, eq);
453  continue;
454  }
455  if(!bracket_round) {
456  expect_token("(", 1, bracket_round);
457  continue;
458  }
459 
460  bool value_except = false;
461  auto col_type = cols.front()->col_type;
462  for(auto& schema : cols) {
463  if(col_type != schema->col_type) {
464  value_except = true;
465  break;
466  }
467  }
468  auto spec = DB::Specs::Interval::make_ptr(col_type);
469  read_cells_interval(*spec.get(), value_except);
470 
471  for(auto& col : specs.columns) {
472  for(auto& schema : cols) {
473  if(col.cid == schema->cid)
474  col.emplace_back(DB::Specs::Interval::make_ptr(*spec.get()));
475  }
476  }
477 
478  bracket_round = false;
479  eq = false;
480  processed = true;
481  continue;
482  }
483 
484  if(!bracket_round) {
485  expect_token(")", 1, bracket_round);
486  continue;
487  }
488  bracket_round = false;
489  processed = false;
490  token_cells = false;
491  possible_and = true;
492  }
493 
494 }
495 
497  bool value_except) {
498 
499  uint32_t escape = 0;
500  bool quote_1 = false;
501  bool quote_2 = false;
502  bool is_quoted = false;
503  bool possible_and = false;
504  bool found_any = false;
505  bool flw_and = false;
506  uint32_t base_remain = remain;
507  const char* base_rptr = ptr;
508 
509  while(remain && !err) {
510 
511  if(possible_and) {
512  found_any = true;
513  if(found_space())
514  continue;
515  if(found_token(TOKEN_AND, LEN_AND)) {
516  possible_and = false;
517  flw_and = true;
518  } else
519  break;
520  }
521 
522  if(!escape && found_char('\\')) {
523  escape = remain;
524  continue;
525  } else if(escape && escape != remain)
526  escape = 0;
527 
528  if(!escape) {
529  if(((!is_quoted || quote_1) && found_quote_single(quote_1)) ||
530  ((!is_quoted || quote_2) && found_quote_double(quote_2))) {
531  is_quoted = quote_1 || quote_2;
532  continue;
533  }
534  if(found_space())
535  continue;
536  }
537 
538  if(is_quoted) {
539  ++ptr;
540  --remain;
541  continue;
542  }
543 
544  if(found_token(TOKEN_RANGE, LEN_RANGE)) {
545  read_range(spec.range_begin, spec.range_end, flw_and);
546  while(found_space());
547  if(found_token(TOKEN_RANGE_END_REST, LEN_RANGE_END_REST))
549  possible_and = true;
550  continue;
551  }
552 
553  if(!found_token(TOKEN_ONLY_KEYS, LEN_ONLY_KEYS) &&
554  found_token(TOKEN_KEY, LEN_KEY)) {
555  auto& key_intval = spec.key_intervals.add();
556  read_key(key_intval.start, key_intval.finish, flw_and, spec.options);
557  possible_and = true;
558  continue;
559  }
560 
561  if(found_token(TOKEN_TIMESTAMP, LEN_TIMESTAMP)) {
562  read_timestamp(spec.ts_start, spec.ts_finish, flw_and);
563  possible_and = true;
564  continue;
565  }
566 
567  if(found_token(TOKEN_VALUE, LEN_VALUE)) {
568  if(value_except)
569  return error_msg(
570  Error::SQL_PARSE_ERROR, "Value require the same columns type");
571  read_value(spec.values.col_type, spec.values.add());
572  possible_and = true;
573  continue;
574  }
575 
576  if(found_token(TOKEN_OFFSET_KEY, LEN_OFFSET_KEY)) {
577  expect_eq();
579  possible_and = true;
580  continue;
581  }
582 
583  if(found_token(TOKEN_OFFSET_REV, LEN_OFFSET_REV)) {
584  expect_eq();
585  std::string buf;
586  read(buf);
587  if(err)
588  return;
589  spec.offset_rev = Time::parse_ns(err, buf);
590  if(err) {
591  error_msg(Error::SQL_PARSE_ERROR, "bad datetime format");
592  return;
593  }
594  possible_and = true;
595  continue;
596  }
597 
598  if(*ptr == ')')
599  break;
600  ++ptr;
601  --remain;
602 
603  }
604 
605  if(!found_any) {
606  remain = base_remain;
607  ptr = base_rptr;
608  }
609  read_flags(spec.flags);
610 
611  if(remain && !err) {
612  seek_space();
613  if(found_token("update", 6)) {
614  read_update(spec);
615  } else if(found_token(TOKEN_DELETE_MATCHING, LEN_DELETE_MATCHING)) {
616  spec.set_opt__deleting();
617  }
618  }
619 }
620 
621 
623  bool flw) {
624  uint32_t base_remain = remain;
625  const char* base_ptr = ptr;
626 
627  Condition::Comp comp_right;
628  expect_comparator(comp_right);
629  if(comp_right != Condition::GE && comp_right != Condition::LE) {
630  error_msg(
631  Error::SQL_PARSE_ERROR, "unsupported 'comparator' allowed GE|LE");
632  return;
633  }
634 
635  if(comp_right == Condition::GE)
636  Reader::read_key(begin);
637  else
638  Reader::read_key(end);
639  if(err)
640  return;
641 
642  uint32_t mark_remain = remain;
643  const char* mark_ptr = ptr;
644 
645  uint32_t remain_start = sql.length()+1;
646 
647  ptr = base_ptr - LEN_RANGE;
648  for(remain = 0; remain++ < remain_start; ) {
649  --ptr;
650  if(flw) {
651  if(found_token(TOKEN_AND, LEN_AND))
652  break;
653  } else if(found_char('('))
654  break;
655  }
656 
657  seek_space();
658  if(*ptr != '[') {
659  remain = mark_remain;
660  ptr = mark_ptr;
661  return;
662  }
663 
664  if(comp_right == Condition::GE)
665  Reader::read_key(end);
666  else
667  Reader::read_key(begin);
668  if(err) {
669  remain = mark_remain;
670  ptr = mark_ptr;
671  return;
672  }
673 
674  Condition::Comp comp_left = Condition::NONE;
675  expect_comparator(comp_left);
676  remain += base_remain;
677  if(comp_left != Condition::GE && comp_left != Condition::LE) {
678  error_msg(
679  Error::SQL_PARSE_ERROR, "unsupported 'comparator' allowed GE|LE");
680  return;
681  }
682  comp_left = comp_left == Condition::GE ? Condition::LE : Condition::GE;
683  if(comp_left == comp_right) {
684  error_msg(Error::SQL_PARSE_ERROR, "bad comparators pair");
685  return;
686  }
687 
688  remain = mark_remain;
689  ptr = mark_ptr;
690 }
691 
693  bool flw, uint8_t& options) {
694  uint32_t base_remain = remain;
695  const char* base_ptr = ptr;
696 
697  Condition::Comp comp_right;
698  expect_comparator(comp_right);
699  if(comp_right != Condition::EQ &&
700  comp_right != Condition::GE && comp_right != Condition::LE) {
701  error_msg(
702  Error::SQL_PARSE_ERROR, "unsupported 'comparator' allowed EQ|GE|LE");
703  return;
704  }
705 
706  if(comp_right == Condition::EQ || comp_right == Condition::GE)
707  read_key(start);
708  else
709  read_key(finish);
710 
711  if(err)
712  return;
713  if(comp_right == Condition::EQ) {
715  return;
716  }
717 
718  uint32_t mark_remain = remain;
719  const char* mark_ptr = ptr;
720 
721  uint32_t remain_start = sql.length()+1;
722 
723  ptr = base_ptr - LEN_KEY;
724  for(remain = 0; remain++ < remain_start; ) {
725  --ptr;
726  if(flw) {
727  if(found_token(TOKEN_AND, LEN_AND))
728  break;
729  } else if(found_char('('))
730  break;
731  }
732 
733  seek_space();
734  if(*ptr != '[') {
735  remain = mark_remain;
736  ptr = mark_ptr;
737  return;
738  }
739 
740  if(comp_right == Condition::GE)
741  read_key(finish);
742  else
743  read_key(start);
744  if(err) {
745  remain = mark_remain;
746  ptr = mark_ptr;
747  return;
748  }
749 
750  Condition::Comp comp_left = Condition::NONE;
751  expect_comparator(comp_left);
752  remain += base_remain;
753  if(comp_left != Condition::GE && comp_left != Condition::LE) {
754  error_msg(
755  Error::SQL_PARSE_ERROR, "unsupported 'comparator' allowed GE|LE");
756  return;
757  }
758  comp_left = comp_left == Condition::GE ? Condition::LE : Condition::GE;
759  if(comp_right == comp_left) {
760  error_msg(Error::SQL_PARSE_ERROR, "bad comparators pair");
761  return;
762  }
763 
764  remain = mark_remain;
765  ptr = mark_ptr;
766 }
767 
769 
770  bool bracket_square = false;
771 
772  seek_space();
773  expect_token("[", 1, bracket_square);
774 
776  std::string fraction;
777  while(remain && !err) {
778  if(found_space())
779  continue;
780 
782  if(comp == Condition::NONE)
783  comp = Condition::EQ;
784  read(fraction, ",]");
785  key.add(std::move(fraction), comp);
786 
787  seek_space();
788  if(found_char(','))
789  continue;
790  break;
791  }
792 
793  expect_token("]", 1, bracket_square);
794 }
795 
797  DB::Specs::Value& value) {
798  switch(col_type) {
800  found_comparator(value.comp);
801  if(value.comp == Condition::NONE)
802  value.comp = Condition::EQ;
803  else if(value.comp != Condition::EQ && value.comp != Condition::NE)
805  "unsupported 'comparator' allowed EQ, NE");
806 
807  bool bracket_square = false;
808  bool was_set;
809  seek_space();
810  expect_token("[", 1, bracket_square);
811  if(err)
812  return;
813 
815  do {
816  uint32_t fid;
817  read_uint32_t(fid, was_set, ":");
818  if(err)
819  return;
820  seek_space();
821  expect_token(":", 1, was_set);
822  if(err)
823  return;
824 
826  if(err)
827  return;
828  switch(typ) {
829 
832  found_comparator(comp);
833  if(!is_numeric_comparator(comp))
834  return;
835  int64_t v;
836  read_int64_t(v, was_set, ",]");
837  if(err)
838  return;
839  fields.add(
841  fid, comp, v));
842  break;
843  }
844 
847  found_comparator(comp);
848  if(!is_numeric_comparator(comp, true))
849  return;
850  long double v;
851  read_double_t(v, was_set, ",]");
852  if(err)
853  return;
854  fields.add(
856  fid, comp, v));
857  break;
858  }
859 
863  if(comp == Condition::NONE)
864  comp = Condition::EQ;
865  std::string buf;
866  read(buf, ",]", comp == Condition::RE);
867  if(err)
868  return;
869  fields.add(
871  break;
872  }
873 
877  if(comp == Condition::NONE)
878  comp = Condition::EQ;
879  else if(comp != Condition::EQ)
880  return error_msg(
882  "unsupported 'comparator' allowed EQ");
883  std::string buf;
884  read(buf, "[");
885  if(err)
886  return;
887  auto seq = DB::Types::range_seq_from(buf);
888  if(seq == DB::Types::KeySeq::UNKNOWN)
889  return error_msg(Error::SQL_PARSE_ERROR, "bad 'KeqSeq'");
890  auto field = DB::Specs::Serial::Value::Field_KEY::make(fid, seq);
891  read_key(field->key);
892  if(err)
893  return;
894  fields.add(std::move(field));
895  break;
896  }
897 
900  found_comparator(comp);
901  if(comp == Condition::NONE)
902  comp = Condition::EQ;
903  else if(comp == Condition::RE || comp == Condition::PF)
904  return error_msg(
905  Error::SQL_PARSE_ERROR, "unsupported PF,RE 'comparator'");
906  seek_space();
907  expect_token("[", 1, bracket_square);
908  if(err)
909  return;
911  fid, comp);
912  do {
913  auto& item = field->items.emplace_back();
914  found_comparator(item.comp = Condition::NONE);
915  if(!is_numeric_comparator(item.comp))
916  return;
917  std::string buff;
918  read(buff, ",]");
919  if(buff.empty()) {
920  field->items.pop_back();
921  } else {
922  try {
923  item.value = std::stoll(buff);
924  } catch(...) {
926  " signed 64-bit integer out of range");
927  }
928  }
929  seek_space();
930  } while(found_char(','));
931 
932  expect_token("]", 1, bracket_square);
933  if(err)
934  return;
935  fields.add(std::move(field));
936  break;
937  }
938 
942  if(comp == Condition::NONE)
943  comp = Condition::EQ;
944  seek_space();
945  expect_token("[", 1, bracket_square);
946  if(err)
947  return;
949  fid, comp);
950  do {
951  auto& item = field->items.emplace_back();
952  found_comparator(item.comp = Condition::NONE);
953  read(item.value, ",]", item.comp == Condition::RE);
954  if(err)
955  return;
956  if(item.comp == Condition::NONE) {
957  if(item.value.empty())
958  field->items.pop_back();
959  else
960  item.comp = Condition::EQ;
961  }
962  seek_space();
963  } while(found_char(','));
964 
965  expect_token("]", 1, bracket_square);
966  if(err)
967  return;
968  fields.add(std::move(field));
969  break;
970  }
971 
972  default: {
973  return error_msg(
974  Error::SQL_PARSE_ERROR, "Not Supported Serial Value Type");
975  }
976  }
977  seek_space();
978  } while(found_char(','));
979 
980  expect_token("]", 1, bracket_square);
981  while(remain && !err && (found_char(' ') || found_char('\t')));
982  if(err)
983  return;
984 
985  fields.encode(value);
986  break;
987  }
988  case DB::Types::Column::COUNTER_I64:
989  case DB::Types::Column::COUNTER_I32:
990  case DB::Types::Column::COUNTER_I16:
991  case DB::Types::Column::COUNTER_I8: {
992  found_comparator(value.comp);
993  if(!is_numeric_comparator(value.comp))
994  return;
995  std::string buf;
996  read(buf, nullptr, false);
997  if(!err)
998  value.set(buf, value.comp);
999  break;
1000  }
1001  default: {
1003  if(value.comp == Condition::NONE)
1004  value.comp = Condition::EQ;
1005  std::string buf;
1006  read(buf, nullptr, value.comp == Condition::RE);
1007  if(!err)
1008  value.set(buf, value.comp);
1009  break;
1010  }
1011  }
1012 }
1013 
1015  DB::Specs::Timestamp& finish, bool flw) {
1016  uint32_t base_remain = remain;
1017  const char* base_ptr = ptr;
1018 
1019  Condition::Comp comp_right;
1020  expect_comparator(comp_right);
1021  if(comp_right != Condition::EQ &&
1022  comp_right != Condition::NE &&
1023  comp_right != Condition::GE &&
1024  comp_right != Condition::GT &&
1025  comp_right != Condition::LE &&
1026  comp_right != Condition::LT) {
1027  error_msg(
1029  "unsupported 'comparator' allowed NE|EQ|GE|GT|LE|LT"
1030  );
1031  return;
1032  }
1033 
1034  std::string buf;
1035  read(buf);
1036  if(err)
1037  return;
1038  int64_t ts = Time::parse_ns(err, buf);
1039  if(err) {
1040  error_msg(Error::SQL_PARSE_ERROR, "bad datetime format");
1041  return;
1042  }
1043 
1044  if(comp_right == Condition::EQ || comp_right == Condition::NE ||
1045  comp_right == Condition::GE || comp_right == Condition::GT)
1046  start.set(ts, comp_right);
1047  else
1048  finish.set(ts, comp_right);
1049 
1050  if(comp_right == Condition::EQ || comp_right == Condition::NE)
1051  return;
1052 
1053  uint32_t mark_remain = remain;
1054  const char* mark_ptr = ptr;
1055 
1056  uint32_t end = sql.length()+1;
1057 
1058  ptr = base_ptr - LEN_TIMESTAMP;
1059  for(remain = 0; remain < end; ) {
1060  ++remain;
1061  --ptr;
1062  if(flw) {
1063  if(found_token(TOKEN_AND, LEN_AND))
1064  break;
1065  } else if(found_char('('))
1066  break;
1067  }
1068 
1069  buf.clear();
1070  read(buf);
1071  if(buf.empty()) {
1072  remain = mark_remain;
1073  ptr = mark_ptr;
1074  return;
1075  }
1076  if(err)
1077  return;
1078  ts = Time::parse_ns(err, buf);
1079  if(err) {
1080  error_msg(Error::SQL_PARSE_ERROR, "bad datetime format");
1081  return;
1082  }
1083 
1084  Condition::Comp comp_left = Condition::NONE;
1085  expect_comparator(comp_left);
1086  remain += base_remain;
1087  if(comp_left != Condition::GE &&
1088  comp_left != Condition::GT &&
1089  comp_left != Condition::LE &&
1090  comp_left != Condition::LT) {
1091  error_msg(
1093  "unsupported 'comparator' allowed GE|GT|LE|LT"
1094  );
1095  return;
1096  }
1097 
1098  comp_left = comp_left == Condition::GE ? Condition::LE
1099  : (comp_left == Condition::GT ? Condition::LT
1100  : (comp_left == Condition::LE ? Condition::GE
1101  : (comp_left == Condition::LT ? Condition::GT : comp_left)));
1102 
1103  if(comp_left == comp_right) {
1104  error_msg(Error::SQL_PARSE_ERROR, "bad comparators pair");
1105  return;
1106  }
1107 
1108  if(finish.was_set)
1109  start.set(ts, comp_left);
1110  else
1111  finish.set(ts, comp_left);
1112 
1113  remain = mark_remain;
1114  ptr = mark_ptr;
1115 }
1116 
1118 
1119  bool any = true;
1120  while(any && remain && !err) {
1121  if(found_space())
1122  continue;
1123 
1124  if((any = found_token(TOKEN_LIMIT, LEN_LIMIT))) {
1125  expect_eq();
1126  read_uint64_t(flags.limit, flags.was_set);
1127  continue;
1128  }
1129  if((any = found_token(TOKEN_OFFSET, LEN_OFFSET))) {
1130  expect_eq();
1131  read_uint64_t(flags.offset, flags.was_set);
1132  continue;
1133  }
1134  if((any = found_token(TOKEN_MAX_VERS, LEN_MAX_VERS))) {
1135  expect_eq();
1136  read_uint32_t(flags.max_versions, flags.was_set);
1137  continue;
1138  }
1139  if((any = found_token(TOKEN_MAX_BUFF, LEN_MAX_BUFF))) {
1140  expect_eq();
1141  read_uint32_t(flags.max_buffer, flags.was_set);
1142  continue;
1143  }
1144 
1145  if((any = found_token(TOKEN_ONLY_DELETES, LEN_ONLY_DELETES))) {
1146  flags.set_only_deletes();
1147  flags.was_set = true;
1148  continue;
1149  }
1150  if((any = found_token(TOKEN_ONLY_KEYS, LEN_ONLY_KEYS))) {
1151  flags.set_only_keys();
1152  flags.was_set = true;
1153  continue;
1154  }
1155  // + LimitType limit_by, offset_by;
1156  }
1157 }
1158 
1160  // update = ('TS', +=|=+|~=|+:#|=:#|='DATA', ENCODER) || ( ) - empty optional
1161 
1162  seek_space();
1164  read_operation(intval.values.col_type, op);
1165  if(err)
1166  return;
1167  if(op.get_op() == DB::Specs::UpdateOP::REPLACE) {
1168  expect_eq();
1169  if(err)
1170  return;
1171  }
1172  seek_space();
1173  bool bracket_round = false;
1174  expect_token("(", 1, bracket_round);
1175  if(err)
1176  return;
1177  DB::Cells::Cell cell;
1178  cell.set_timestamp_null();
1181  intval.values.col_type,
1182  false,
1183  cell,
1184  &encoder,
1186  );
1187 
1188  if(remain && !err) {
1190  encoder,
1191  cell.value,
1192  cell.vlen,
1193  cell.get_timestamp(),
1194  op,
1195  false
1196  );
1197  cell.value = nullptr;
1198  cell.vlen = 0;
1199  }
1200  seek_space();
1201  expect_token(")", 1, bracket_round);
1202 }
1203 
1204 
1205 
1206 }}} // SWC::client:SQL namespace
SWC::Condition::LE
@ LE
Definition: Comparators.h:33
SWC::DB::Specs::Serial::Value::Field_DOUBLE::make
static SWC_CAN_INLINE Field::Ptr make(uint24_t fid, Condition::Comp comp, const long double &value)
Definition: SpecsValueSerialFields.h:112
SWC::Core::Vector::front
constexpr SWC_CAN_INLINE reference front() noexcept
Definition: Vector.h:243
SWC::Error::SQL_PARSE_ERROR
@ SQL_PARSE_ERROR
Definition: Error.h:122
SWC::DB::Schemas::TagsPattern::comp
Condition::Comp comp
Definition: Schemas.h:87
SWC::DB::Specs::Scan
Definition: SpecsScan.h:21
SWC::Error::Exception::code
constexpr SWC_CAN_INLINE int code() const noexcept
Definition: Exception.h:51
SWC::DB::COLUMN
@ COLUMN
Definition: Cell.h:47
SWC::DB::Specs::Interval::key_intervals
KeyIntervals key_intervals
Definition: SpecsInterval.h:239
SWC::client::SQL::Reader::expect_eq
void expect_eq()
Definition: Reader.cc:82
SWC::DB::NO_VALUE
@ NO_VALUE
Definition: Cell.h:52
SWC::DB::Specs::Interval::OPT_KEY_EQUAL
static constexpr const uint8_t OPT_KEY_EQUAL
Definition: SpecsInterval.h:28
SWC::client::SQL::QuerySelect::read_key
void read_key(DB::Specs::Key &start, DB::Specs::Key &finish, bool flw, uint8_t &options)
Definition: QuerySelect.cc:692
SWC::DB::Specs::Interval::values
Values values
Definition: SpecsInterval.h:240
SWC::client::SQL::Reader::expect_token
void expect_token(const char *token, uint8_t token_len, bool &found)
Definition: Reader.cc:122
SWC::DB::Schema::Ptr
std::shared_ptr< Schema > Ptr
Definition: Schema.h:185
SWC::Condition::GE
@ GE
Definition: Comparators.h:31
SWC::DB::Specs::Serial::Value::Fields::add
void add(Field::Ptr &&field)
Definition: SpecsValueSerialFields.cc:724
SWC::Core::Vector::clear
SWC_CAN_INLINE void clear() noexcept(_NoExceptDestructor)
Definition: Vector.h:120
SWC::DB::Specs::Value::set
SWC_CAN_INLINE void set(const char *data_n, Condition::Comp comp_n, bool owner)
Definition: SpecsValue.h:124
SWC::client::SQL::Reader::read_ts_and_value
void read_ts_and_value(DB::Types::Column col_type, bool require_ts, DB::Cells::Cell &cell, DB::Types::Encoder *encoder, bool w_serial=false)
Definition: Reader.cc:517
SWC::DB::Specs::UpdateOP::REPLACE
static constexpr const uint8_t REPLACE
Definition: SpecsUpdateOp.h:20
SpecsValueSerialFields.h
SWC::DB::Specs::Serial::Value::Fields
Definition: SpecsValueSerialFields.h:335
SWC::Core::Encoder::Type
Type
Definition: Encoder.h:28
SWC::Condition::GT
@ GT
Definition: Comparators.h:30
SWC::DB::Cell::Serial::Value::Type
Type
Definition: CellValueSerialField.h:33
SWC::client::Clients::Ptr
ClientsPtr Ptr
Definition: Clients.h:58
SWC::DB::Types::range_seq_from
KeySeq SWC_PURE_FUNC range_seq_from(const std::string &typ) noexcept
Definition: KeySeq.cc:48
SWC::DB::NO_ENCODE
@ NO_ENCODE
Definition: Cell.h:53
SWC::DB::Specs::UpdateOP::SERIAL
static constexpr const uint8_t SERIAL
Definition: SpecsUpdateOp.h:26
SWC::DB::Types::Column
Column
Definition: Column.h:18
SWC::client::SQL::Reader::seek_space
void seek_space()
Definition: Reader.cc:78
SWC::Condition::COMP_EXTENDED_VALUE
const uint COMP_EXTENDED_VALUE
Definition: Comparators.h:24
SWC::DB::Specs::Interval::range_begin
Cell::Key range_begin
Definition: SpecsInterval.h:238
SWC::client::SQL::Reader::read_uint64_t
void read_uint64_t(uint64_t &value, bool &was_set, const char *stop=nullptr)
Definition: Reader.cc:274
SWC::client::SQL::Reader::remain
uint32_t remain
Definition: Reader.h:124
SWC::Condition::LT
@ LT
Definition: Comparators.h:34
SWC::DB::BINARY
@ BINARY
Definition: Cell.h:44
SWC::DB::Specs::Interval::options
uint8_t options
Definition: SpecsInterval.h:247
SWC::DB::Cells::Cell
Definition: Cell.h:92
SWC::DB::Specs::Interval::ts_start
Timestamp ts_start
Definition: SpecsInterval.h:241
SWC::client::SQL::Reader::read_column_tags
void read_column_tags(DB::Schemas::TagsPattern &tags)
Definition: Reader.cc:416
SWC::DB::Schemas::SelectorPatterns
Definition: Schemas.h:100
SWC::Condition::COMP_EXTENDED_KEY
const uint COMP_EXTENDED_KEY
Definition: Comparators.h:25
SWC::client::SQL::Reader
Definition: Reader.h:28
SWC::DB::Cell::Key
Definition: CellKey.h:24
SWC::client::SQL::QuerySelect::add_column
DB::Schema::Ptr add_column(const std::string &col)
Definition: QuerySelect.cc:398
SWC::DB::Specs::Key
Definition: SpecsKey.h:136
SWC::DB::Schemas::SelectorPatterns::names
NamePatterns names
Definition: Schemas.h:101
SWC::Condition::RE
@ RE
Definition: Comparators.h:36
SWC::Condition::eq
SWC_CAN_INLINE bool eq(const uint8_t *p1, uint32_t p1_len, const uint8_t *p2, uint32_t p2_len) noexcept
Definition: Comparators.h:195
SWC::DB::Specs::Serial::Value::Field_KEY::make
static SWC_CAN_INLINE std::unique_ptr< Field_KEY > make(uint24_t fid, Types::KeySeq seq)
Definition: SpecsValueSerialFields.h:186
SWC::DB::Specs::UpdateOP::get_op
SWC_CAN_INLINE uint8_t get_op() const noexcept
Definition: SpecsUpdateOp.h:100
SWC::client::SQL::Reader::found_comparator
bool found_comparator(Condition::Comp &comp, uint8_t extended=0x00)
Definition: Reader.cc:67
SWC::DB::SPECS
@ SPECS
Definition: Cell.h:45
SWC::client::SQL::QuerySelect::read_range
void read_range(DB::Cell::Key &begin, DB::Cell::Key &end, bool flw)
Definition: QuerySelect.cc:622
SWC::DB::Specs::Flags::was_set
bool was_set
Definition: SpecsFlags.h:146
SWC::client::SQL::Reader::read_int64_t
void read_int64_t(int64_t &value, bool &was_set, const char *stop=nullptr)
Definition: Reader.cc:259
SWC::DB::Cell::Serial::Value::DOUBLE
@ DOUBLE
Definition: CellValueSerialField.h:36
SWC::client::SQL::QuerySelect::read_value
void read_value(DB::Types::Column col_type, DB::Specs::Value &value)
Definition: QuerySelect.cc:796
SWC::client::SQL::Reader::found_char
bool found_char(const char c)
Definition: Reader.cc:28
encoder
Core::Encoder::Type encoder
Buffer Encoder.
Definition: HeaderBufferInfo.h:50
SWC::DB::Cell::Serial::Value::BYTES
@ BYTES
Definition: CellValueSerialField.h:37
SWC::client::SQL::Reader::is_numeric_comparator
bool is_numeric_comparator(Condition::Comp &comp, bool _double=false)
Definition: Reader.cc:388
SWC::client::SQL::Reader::found_space
bool found_space()
Definition: Reader.cc:37
SWC::DB::STATS
@ STATS
Definition: Cell.h:46
SWC::Condition::Comp
Comp
Definition: Comparators.h:27
SWC::Core::Vector::empty
constexpr SWC_CAN_INLINE bool empty() const noexcept
Definition: Vector.h:168
SWC::client::SQL::Reader::get_schema
DB::Schema::Ptr get_schema(const Clients::Ptr &clients, const std::string &col)
Definition: Reader.cc:137
SWC::client::SQL::Reader::read_double_t
void read_double_t(long double &value, bool &was_set, const char *stop=nullptr)
Definition: Reader.cc:289
SWC::DB::Specs::Scan::columns
Columns columns
Definition: SpecsScan.h:101
SWC::DB::Cell::Serial::Value::UNKNOWN
@ UNKNOWN
Definition: CellValueSerialField.h:34
SWC::client::SQL::Reader::read
void read(std::string &buf, const char *stop=nullptr, bool keep_escape=false)
Definition: Reader.cc:185
SWC::client::SQL::Reader::expect_comparator
void expect_comparator(Condition::Comp &comp, uint8_t extended=0x00)
Definition: Reader.cc:93
SWC::client::SQL::Reader::read_key
void read_key(DB::Cell::Key &key)
Definition: Reader.cc:364
SWC::DB::Specs::KeyIntervals::add
KeyInterval & add()
Definition: SpecsKeyIntervals.cc:28
SWC_CURRENT_EXCEPTION
#define SWC_CURRENT_EXCEPTION(_msg_)
Definition: Exception.h:119
SWC
The SWC-DB C++ namespace 'SWC'.
Definition: main.cc:12
Property.h
SWC::Time::parse_ns
int64_t parse_ns(int &err, const std::string &buf)
Definition: Time.cc:37
SWC::client::SQL::QuerySelect::read_timestamp
void read_timestamp(DB::Specs::Timestamp &start, DB::Specs::Timestamp &finish, bool flw)
Definition: QuerySelect.cc:1014
SWC::DB::Cell::Serial::Value::INT64
@ INT64
Definition: CellValueSerialField.h:35
SWC::DB::Specs::Timestamp
Definition: SpecsTimestamp.h:18
SWC::Condition::EQ
@ EQ
Definition: Comparators.h:32
SWC::DB::Specs::Serial::Value::Field_INT64::make
static SWC_CAN_INLINE Field::Ptr make(uint24_t fid, Condition::Comp comp, int64_t value)
Definition: SpecsValueSerialFields.h:81
SWC::DB::Specs::Interval::ts_finish
Timestamp ts_finish
Definition: SpecsInterval.h:241
SWC::Condition::NE
@ NE
Definition: Comparators.h:35
SWC::client::SQL::QuerySelect::parse_display_flags
void parse_display_flags(uint8_t &display_flags)
Definition: QuerySelect.cc:251
SWC::DB::Cells::Cell::value
uint8_t * value
Definition: Cell.h:362
SWC::Condition::PF
@ PF
Definition: Comparators.h:29
SWC::client::SQL::Reader::found_quote_double
bool found_quote_double(bool &quote)
Definition: Reader.cc:50
SWC::DB::Specs::Serial::Value::Field_LIST_BYTES::make
static SWC_CAN_INLINE std::unique_ptr< Field_LIST_BYTES > make(uint24_t fid, Condition::Comp comp)
Definition: SpecsValueSerialFields.h:297
SWC::Config::Property::from_string
void from_string(const char *s, double *value)
Definition: Property.cc:109
Time.h
SWC::client::SQL::Reader::found_token
bool found_token(const char *token, uint8_t token_len)
Definition: Reader.cc:58
SWC::DB::Specs::Interval::set_opt__range_end_rest
constexpr SWC_CAN_INLINE void set_opt__range_end_rest() noexcept
Definition: SpecsInterval.h:153
SWC::DB::Specs::Interval::flags
Flags flags
Definition: SpecsInterval.h:242
SWC::DB::Cell::Serial::Value::LIST_INT64
@ LIST_INT64
Definition: CellValueSerialField.h:39
SWC::Condition::NONE
@ NONE
Definition: Comparators.h:28
SWC::DB::Specs::Interval::make_ptr
static SWC_CAN_INLINE Ptr make_ptr(Types::Column col_type=Types::Column::UNKNOWN)
Definition: SpecsInterval.h:36
SWC::DB::Specs::Value
Definition: SpecsValue.h:17
SWC::DB::Specs::Serial::Value::Field_LIST_INT64::make
static SWC_CAN_INLINE std::unique_ptr< Field_LIST_INT64 > make(uint24_t fid, Condition::Comp comp)
Definition: SpecsValueSerialFields.h:238
SWC::DB::Specs::Interval::range_end
Cell::Key range_end
Definition: SpecsInterval.h:238
SWC::DB::Specs::Flags
Definition: SpecsFlags.h:18
QuerySelect.h
SWC::DB::Cells::Cell::vlen
uint32_t vlen
Definition: Cell.h:361
SWC::client::SQL::Reader::found_quote_single
bool found_quote_single(bool &quote)
Definition: Reader.cc:42
SWC::Core::Vector< Schema::Ptr >
SWC::client::SQL::Reader::read_serial_value_type
DB::Cell::Serial::Value::Type read_serial_value_type()
Definition: Reader.cc:339
SWC::DB::Schemas::SelectorPatterns::tags
TagsPattern tags
Definition: Schemas.h:102
SWC::DB::Specs::Interval::updating
IntervalUpdate::Ptr updating
Definition: SpecsInterval.h:249
SWC::client::SQL::QuerySelect::read_cells_intervals
void read_cells_intervals(const DB::SchemasVec &cols)
Definition: QuerySelect.cc:428
SWC::DB::Specs::Key::add
Fraction & add(Fraction &&other)
Definition: SpecsKey.cc:64
SWC::DB::Specs::Interval
Definition: SpecsInterval.h:25
SWC::client::SQL::Reader::read_operation
void read_operation(const DB::Types::Column col_type, DB::Specs::UpdateOP &operation)
Definition: Reader.cc:485
SWC::DB::Cells::Cell::get_timestamp
constexpr SWC_CAN_INLINE int64_t get_timestamp() const noexcept
Definition: Cell.h:317
SWC::client::SQL::Reader::err
int err
Definition: Reader.h:125
SWC::client::SQL::Reader::read_column
void read_column(const char *stop, std::string &col_name, DB::Schemas::NamePatterns &names)
Definition: Reader.cc:467
SWC::DB::Specs::Values::add
Value & add(Condition::Comp comp=Condition::EQ)
Definition: SpecsValues.cc:24
SWC::Core::Vector::cend
constexpr SWC_CAN_INLINE const_iterator cend() const noexcept
Definition: Vector.h:232
SWC::client::SQL::Reader::ptr
const char * ptr
Definition: Reader.h:123
SWC::DB::Specs::Interval::offset_rev
int64_t offset_rev
Definition: SpecsInterval.h:245
SWC::DB::TIMESTAMP
@ TIMESTAMP
Definition: Cell.h:42
SWC::client::SQL::QuerySelect::read_update
void read_update(DB::Specs::Interval &intval)
Definition: QuerySelect.cc:1159
SWC::DB::Specs::Interval::offset_key
Cell::Key offset_key
Definition: SpecsInterval.h:244
SWC::DB::NO_TS
@ NO_TS
Definition: Cell.h:51
SWC::client::SQL::QuerySelect::clients
Clients::Ptr clients
Definition: QuerySelect.h:62
SWC::DB::DATETIME
@ DATETIME
Definition: Cell.h:43
SWC::Common::Files::Schema::filepath
std::string filepath(cid_t cid)
Definition: Schema.h:34
SWC::DB::Specs::Timestamp::was_set
bool was_set
Definition: SpecsTimestamp.h:126
SWC::DB::Cells::Cell::set_timestamp_null
constexpr SWC_CAN_INLINE void set_timestamp_null() noexcept
Definition: Cell.h:188
SWC::DB::Specs::Interval::set_opt__deleting
constexpr SWC_CAN_INLINE void set_opt__deleting() noexcept
Definition: SpecsInterval.h:163
SWC::DB::Specs::Scan::flags
Flags flags
Definition: SpecsScan.h:102
SWC::client::SQL::QuerySelect::QuerySelect
QuerySelect(const Clients::Ptr &clients, const std::string &sql, DB::Specs::Scan &specs, std::string &message)
Definition: QuerySelect.cc:62
SWC::client::SQL::QuerySelect::parse_select
int parse_select()
Definition: QuerySelect.cc:69
SWC::DB::Cell::Serial::Value::LIST_BYTES
@ LIST_BYTES
Definition: CellValueSerialField.h:40
flags
uint8_t flags
Flags.
Definition: Header.h:55
SWC::DB::Types::Column::SERIAL
@ SERIAL
SWC::client::SQL::QuerySelect::read_flags
void read_flags(DB::Specs::Flags &flags)
Definition: QuerySelect.cc:1117
SWC::client::SQL::Reader::error_msg
void error_msg(int error, const std::string &msg)
Definition: Reader.cc:841
SWC::Core::Vector::push_back
SWC_CAN_INLINE void push_back(ArgsT &&... args)
Definition: Vector.h:331
SWC::client::SQL::QuerySelect::read_cells_interval
void read_cells_interval(DB::Specs::Interval &spec, bool value_except)
Definition: QuerySelect.cc:496
SWC::DB::Specs::Values::col_type
Types::Column col_type
Definition: SpecsValues.h:26
SWC::Core::Vector::cbegin
constexpr SWC_CAN_INLINE const_iterator cbegin() const noexcept
Definition: Vector.h:216
SWC::client::SQL::QuerySelect::parse_dump
int parse_dump(std::string &fs, std::string &filepath, uint64_t &split_size, std::string &ext, int &level)
Definition: QuerySelect.cc:105
SWC::Error::Exception::what
virtual SWC_CAN_INLINE const char * what() const noexcept override
Definition: Exception.h:56
SWC::client::SQL::Reader::read_uint32_t
void read_uint32_t(uint32_t &value, bool &was_set, const char *stop=nullptr)
Definition: Reader.cc:250
SWC::client::SQL::QuerySelect::read_columns_intervals
void read_columns_intervals()
Definition: QuerySelect.cc:285
SWC::client::SQL::QuerySelect::specs
DB::Specs::Scan & specs
Definition: QuerySelect.h:63
SWC::DB::Specs::UpdateOP
Definition: SpecsUpdateOp.h:18
SWC::DB::Specs::IntervalUpdate::make
static SWC_CAN_INLINE Ptr make(ArgsT &&... args)
Definition: SpecsIntervalUpdate.h:38
SWC::Core::Vector::emplace_back
SWC_CAN_INLINE reference emplace_back(ArgsT &&... args)
Definition: Vector.h:349
SWC::DB::Specs::Serial::Value::Field_BYTES::make
static SWC_CAN_INLINE Field::Ptr make(uint24_t fid, Condition::Comp comp, const uint8_t *ptr, size_t len)
Definition: SpecsValueSerialFields.h:144
SWC::Error::Exception
Definition: Exception.h:21
SWC::DB::Cell::Serial::Value::KEY
@ KEY
Definition: CellValueSerialField.h:38
SWC::client::SQL::Reader::sql
const std::string & sql
Definition: Reader.h:121
SWC::DB::Specs::Timestamp::set
constexpr SWC_CAN_INLINE void set(int64_t timestamp, Condition::Comp comperator) noexcept
Definition: SpecsTimestamp.h:54
SWC::DB::Specs::Value::comp
Condition::Comp comp
Definition: SpecsValue.h:250
SWC::client::SQL::QuerySelect::parse_output_flags
void parse_output_flags(uint8_t &output_flags)
Definition: QuerySelect.cc:230
SWC::DB::Specs::Serial::Value::Fields::encode
void encode(Specs::Value &value) const
Definition: SpecsValueSerialFields.cc:735