src/CLIParser.h
branchv_0
changeset 24 884ece10575d
parent 17 b3c07fb178be
child 34 24c05e69d68f
equal deleted inserted replaced
23:d3bfbce022aa 24:884ece10575d
    46 	}
    46 	}
    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_TYPE_CAST;
    51 	static const string_t OPTION_PARAMETER;
    52 	static const string_t OPTION_PARAMETER;
    52 	static const string_t OPTION_COPY;
    53 	static const string_t OPTION_COPY;
    53 	static const string_t OPTION_COPY_RENAMED;
    54 	static const string_t OPTION_COPY_RENAMED;
    54 	static const string_t OPTION_FILE;
    55 	static const string_t OPTION_FILE;
    55 	static const string_t OPTION_FILE_KEEP;
    56 	static const string_t OPTION_FILE_KEEP;
    63 
    64 
    64 			if (option == OPTION_RELATION) {
    65 			if (option == OPTION_RELATION) {
    65 				addQuery(c, currentQuery); // previous relation
    66 				addQuery(c, currentQuery); // previous relation
    66 				currentQuery.relation = readNext(arguments, i);
    67 				currentQuery.relation = readNext(arguments, i);
    67 				currentQuery.sql = readNext(arguments, i);
    68 				currentQuery.sql = readNext(arguments, i);
       
    69 			} else if (option == OPTION_TYPE_CAST) {
       
    70 				TypeCast typeCast;
       
    71 				typeCast.name = readNext(arguments, i);
       
    72 				typeCast.type = readNext(arguments, i);
       
    73 				currentQuery.typeCasts.push_back(typeCast);
    68 			} else if (option == OPTION_PARAMETER) {
    74 			} else if (option == OPTION_PARAMETER) {
    69 				Parameter parameter;
    75 				Parameter parameter;
    70 				parameter.value = readNext(arguments, i);
    76 				parameter.value = readNext(arguments, i);
    71 				currentQuery.parameters.push_back(parameter);
    77 				currentQuery.parameters.push_back(parameter);
    72 			} else if (option == OPTION_COPY) {
    78 			} else if (option == OPTION_COPY) {
    95 
   101 
    96 // relpipe-tr-sql --relation "tabulka" "SELECT * FROM fstab WHERE id = ?" --parameter "123"
   102 // relpipe-tr-sql --relation "tabulka" "SELECT * FROM fstab WHERE id = ?" --parameter "123"
    97 // TODO: --type string/integer/boolean (default is string)
   103 // TODO: --type string/integer/boolean (default is string)
    98 
   104 
    99 const string_t CLIParser::OPTION_RELATION = L"--relation";
   105 const string_t CLIParser::OPTION_RELATION = L"--relation";
       
   106 const string_t CLIParser::OPTION_TYPE_CAST = L"--type-cast";
   100 const string_t CLIParser::OPTION_PARAMETER = L"--parameter";
   107 const string_t CLIParser::OPTION_PARAMETER = L"--parameter";
   101 const string_t CLIParser::OPTION_COPY = L"--copy";
   108 const string_t CLIParser::OPTION_COPY = L"--copy";
   102 const string_t CLIParser::OPTION_COPY_RENAMED = L"--copy-renamed";
   109 const string_t CLIParser::OPTION_COPY_RENAMED = L"--copy-renamed";
   103 const string_t CLIParser::OPTION_FILE = L"--file";
   110 const string_t CLIParser::OPTION_FILE = L"--file";
   104 const string_t CLIParser::OPTION_FILE_KEEP = L"--file-keep";
   111 const string_t CLIParser::OPTION_FILE_KEEP = L"--file-keep";