src/CLIParser.h
branchv_0
changeset 14 eacacf060755
parent 12 0b38339b871b
child 16 3c51a2c32c86
equal deleted inserted replaced
13:19580b27ade2 14:eacacf060755
    47 
    47 
    48 public:
    48 public:
    49 
    49 
    50 	static const string_t OPTION_RELATION;
    50 	static const string_t OPTION_RELATION;
    51 	static const string_t OPTION_PARAMETER;
    51 	static const string_t OPTION_PARAMETER;
       
    52 	static const string_t OPTION_DUMP;
    52 	static const string_t OPTION_FILE;
    53 	static const string_t OPTION_FILE;
    53 	static const string_t OPTION_KEEP_FILE;
    54 	static const string_t OPTION_KEEP_FILE;
    54 
    55 
    55 	Configuration parse(const std::vector<string_t>& arguments) {
    56 	Configuration parse(const std::vector<string_t>& arguments) {
    56 		Configuration c;
    57 		Configuration c;
    65 				currentQuery.sql = readNext(arguments, i);
    66 				currentQuery.sql = readNext(arguments, i);
    66 			} else if (option == OPTION_PARAMETER) {
    67 			} else if (option == OPTION_PARAMETER) {
    67 				Parameter parameter;
    68 				Parameter parameter;
    68 				parameter.value = readNext(arguments, i);
    69 				parameter.value = readNext(arguments, i);
    69 				currentQuery.parameters.push_back(parameter);
    70 				currentQuery.parameters.push_back(parameter);
       
    71 			} else if (option == OPTION_DUMP) {
       
    72 				c.dumpRelations = readNext(arguments, i);
    70 			} else if (option == OPTION_FILE) {
    73 			} else if (option == OPTION_FILE) {
    71 				c.file = readNext(arguments, i);
    74 				c.file = readNext(arguments, i);
    72 			} else if (option == OPTION_KEEP_FILE) {
    75 			} else if (option == OPTION_KEEP_FILE) {
    73 				string_t value = readNext(arguments, i);
    76 				string_t value = readNext(arguments, i);
    74 				if (value == L"auto") c.keepFile = KeepFile::Automatic;
    77 				if (value == L"auto") c.keepFile = KeepFile::Automatic;
    90 // relpipe-tr-sql --relation "tabulka" "SELECT * FROM fstab WHERE id = ?" --parameter "123"
    93 // relpipe-tr-sql --relation "tabulka" "SELECT * FROM fstab WHERE id = ?" --parameter "123"
    91 // TODO: --type string/integer/boolean (default is string)
    94 // TODO: --type string/integer/boolean (default is string)
    92 
    95 
    93 const string_t CLIParser::OPTION_RELATION = L"--relation";
    96 const string_t CLIParser::OPTION_RELATION = L"--relation";
    94 const string_t CLIParser::OPTION_PARAMETER = L"--parameter";
    97 const string_t CLIParser::OPTION_PARAMETER = L"--parameter";
       
    98 const string_t CLIParser::OPTION_DUMP = L"--dump";
    95 const string_t CLIParser::OPTION_FILE = L"--file";
    99 const string_t CLIParser::OPTION_FILE = L"--file";
    96 const string_t CLIParser::OPTION_KEEP_FILE = L"--keep-file";
   100 const string_t CLIParser::OPTION_KEEP_FILE = L"--keep-file";
    97 
   101 
    98 }
   102 }
    99 }
   103 }