MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / get

Method get

tools/cdb2_sqlreplay/cdb2_sqlreplay.cpp:912–945  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

910 }
911
912 void get() {
913 std::string line;
914 if (done)
915 return;
916 for (;;) {
917 if (value != nullptr) {
918 cson_free_value(value);
919 value = nullptr;
920 }
921 if (!std::getline(file, line)) {
922 done = true;
923 return;
924 }
925 linenum++;
926 if (line.empty())
927 continue;
928 int rc = cson_parse_string(&value, line.c_str(), line.length());
929 if (rc) {
930 std::cerr << "Error: Malformed input on line " << linenum << std::endl;
931 continue;
932 }
933 if (!cson_value_is_object(value)) {
934 std::cerr << "Error: Not an object on line " << linenum << std::endl;
935 continue;
936 }
937 const char *type = get_strprop(value, "type");
938 // skip anything with no type field (we don't know what it is) or timestamp (we don't know the order of replay)
939 if (type == nullptr || strcmp(type, "sql") != 0)
940 continue;
941 if (!get_intprop(value, "time", &timestamp))
942 continue;
943 break;
944 }
945 }
946
947 bool is_done() const {
948 return done;

Callers

nothing calls this directly

Calls 6

cson_free_valueFunction · 0.85
cson_parse_stringFunction · 0.85
cson_value_is_objectFunction · 0.85
get_strpropFunction · 0.85
get_intpropFunction · 0.85
emptyMethod · 0.80

Tested by

no test coverage detected