44 c.relationConfigurations.push_back(currentRelation); |
44 c.relationConfigurations.push_back(currentRelation); |
45 currentRelation = RelationConfiguration(); |
45 currentRelation = RelationConfiguration(); |
46 } |
46 } |
47 } |
47 } |
48 |
48 |
49 bool parseBoolean(const string_t& value, const string_t& optionName) { |
|
50 if (value == L"true") return true; |
|
51 else if (value == L"false") return false; |
|
52 else throw relpipe::cli::RelpipeCLIException(L"Unable to parse boolean value of option: " + optionName + L" (expecting true or false)", relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS); |
|
53 } |
|
54 |
|
55 relpipe::writer::TypeId parseTypeId(const string_t& value) { |
49 relpipe::writer::TypeId parseTypeId(const string_t& value) { |
56 using t = relpipe::writer::TypeId; |
50 using t = relpipe::writer::TypeId; |
57 if (value == L"string") return t::STRING; |
51 if (value == L"string") return t::STRING; |
58 else if (value == L"integer") return t::INTEGER; |
52 else if (value == L"integer") return t::INTEGER; |
59 else if (value == L"boolean") return t::BOOLEAN; |
53 else if (value == L"boolean") return t::BOOLEAN; |
81 |
75 |
82 if (option == OPTION_BEFORE_RECORDS) currentRelation.guileBeforeRecords = readNext(arguments, i); |
76 if (option == OPTION_BEFORE_RECORDS) currentRelation.guileBeforeRecords = readNext(arguments, i); |
83 else if (option == OPTION_AFTER_RECORDS) currentRelation.guileAfterRecords = readNext(arguments, i); |
77 else if (option == OPTION_AFTER_RECORDS) currentRelation.guileAfterRecords = readNext(arguments, i); |
84 else if (option == OPTION_FOR_EACH) currentRelation.guileForEach = readNext(arguments, i); |
78 else if (option == OPTION_FOR_EACH) currentRelation.guileForEach = readNext(arguments, i); |
85 else if (option == OPTION_WHERE) currentRelation.guileWhere = readNext(arguments, i); |
79 else if (option == OPTION_WHERE) currentRelation.guileWhere = readNext(arguments, i); |
86 else if (option == OPTION_DROP) currentRelation.drop = parseBoolean(readNext(arguments, i), option); |
80 else if (option == OPTION_DROP) currentRelation.drop = true; |
87 else if (option == OPTION_RELATION) { |
81 else if (option == OPTION_RELATION) { |
88 addRelation(c, currentRelation); // previous relation |
82 addRelation(c, currentRelation); // previous relation |
89 currentRelation.relation = readNext(arguments, i); |
83 currentRelation.relation = readNext(arguments, i); |
90 } else if (option == OPTION_OUTPUT_ATTRIBUTE) { |
84 } else if (option == OPTION_OUTPUT_ATTRIBUTE) { |
91 relpipe::writer::AttributeMetadata attribute; |
85 relpipe::writer::AttributeMetadata attribute; |