From 11e0492561eb44026a86addf5c56decb790be385 Mon Sep 17 00:00:00 2001 From: Leonid Fedorov Date: Tue, 15 Jul 2025 15:24:54 +0000 Subject: [PATCH] chore(build): replace contains method of map with count for gcc 8.5 --- writeengine/bulk/we_cmdargs.cpp | 18 ++++++++--------- writeengine/splitter/we_cmdargs.cpp | 30 ++++++++++++++--------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/writeengine/bulk/we_cmdargs.cpp b/writeengine/bulk/we_cmdargs.cpp index 640e42867..f0e91d664 100644 --- a/writeengine/bulk/we_cmdargs.cpp +++ b/writeengine/bulk/we_cmdargs.cpp @@ -235,13 +235,13 @@ void WECmdArgs::parseCmdLineArgs(int argc, char** argv) po::store(po::command_line_parser(argc, argv).options(*fOptions).positional(pos_opt).run(), vm); po::notify(vm); - if (vm.contains("help")) + if (vm.count("help")) { fHelp = true; usage(); return; } - if (vm.contains("separator")) + if (vm.count("separator")) { auto value = vm["separator"].as(); if (value == "\\t") @@ -253,7 +253,7 @@ void WECmdArgs::parseCmdLineArgs(int argc, char** argv) fColDelim = value[0]; } } - if (vm.contains("binary-mode")) + if (vm.count("binary-mode")) { int value = vm["binary-mode"].as(); if (value == 1) @@ -269,7 +269,7 @@ void WECmdArgs::parseCmdLineArgs(int argc, char** argv) startupError("Invalid Binary mode; value can be 1 or 2"); } } - if (vm.contains("tz")) + if (vm.count("tz")) { auto tz = vm["tz"].as(); long offset; @@ -279,7 +279,7 @@ void WECmdArgs::parseCmdLineArgs(int argc, char** argv) } fTimeZone = tz; } - if (vm.contains("job-id")) + if (vm.count("job-id")) { errno = 0; string optarg = vm["job-id"].as(); @@ -296,7 +296,7 @@ void WECmdArgs::parseCmdLineArgs(int argc, char** argv) startupError("Wrong JobID Value"); } } - if (vm.contains("allow-missing-columns")) + if (vm.count("allow-missing-columns")) { if (vm["allow-missing-columns"].as() == "AllowMissingColumn") { @@ -328,15 +328,15 @@ void WECmdArgs::parseCmdLineArgs(int argc, char** argv) if (2 == fArgMode && fPmFilePath.empty()) throw runtime_error("-f option is mandatory with mode 2."); - if (vm.contains("dbname")) + if (vm.count("dbname")) { fSchema = vm["dbname"].as(); } - if (vm.contains("table")) + if (vm.count("table")) { fTable = vm["table"].as(); } - if (vm.contains("load-file")) + if (vm.count("load-file")) { fLocFile = vm["load-file"].as(); } diff --git a/writeengine/splitter/we_cmdargs.cpp b/writeengine/splitter/we_cmdargs.cpp index 87ed30e1d..ffdfcf285 100644 --- a/writeengine/splitter/we_cmdargs.cpp +++ b/writeengine/splitter/we_cmdargs.cpp @@ -645,17 +645,17 @@ void WECmdArgs::parseCmdLineArgs(int argc, char** argv) po::store(po::command_line_parser(argc, argv).options(*fOptions).positional(pos_opt).run(), vm); po::notify(vm); - if (vm.contains("silent")) + if (vm.count("silent")) { fConsoleOutput = !vm["silent"].as(); } - if (vm.contains("help")) + if (vm.count("help")) { fHelp = true; usage(); return; } - if (vm.contains("separator")) + if (vm.count("separator")) { auto value = vm["separator"].as(); if (value == "\\t") @@ -675,7 +675,7 @@ void WECmdArgs::parseCmdLineArgs(int argc, char** argv) } } } - if (vm.contains("binary-mode")) + if (vm.count("binary-mode")) { int value = vm["binary-mode"].as(); if (value == 1) @@ -691,7 +691,7 @@ void WECmdArgs::parseCmdLineArgs(int argc, char** argv) throw runtime_error("Invalid Binary mode; value can be 1 or 2"); } } - if (vm.contains("tz")) + if (vm.count("tz")) { auto tz = vm["tz"].as(); long offset; @@ -701,7 +701,7 @@ void WECmdArgs::parseCmdLineArgs(int argc, char** argv) } fTimeZone = tz; } - if (vm.contains("job-id")) + if (vm.count("job-id")) { errno = 0; string optarg = vm["job-id"].as(); @@ -720,12 +720,12 @@ void WECmdArgs::parseCmdLineArgs(int argc, char** argv) aJobType = true; } - if (vm.contains("verbose")) + if (vm.count("verbose")) { string optarg = vm["verbose"].as(); fVerbose = fDebugLvl = optarg.length(); } - if (vm.contains("batch-quantity")) + if (vm.count("batch-quantity")) { if (fBatchQty < 10000) { @@ -770,12 +770,12 @@ void WECmdArgs::parseCmdLineArgs(int argc, char** argv) if (0 == fArgMode) throw runtime_error("Incompatible mode and option types"); - if (vm.contains("dbname")) + if (vm.count("dbname")) { fSchema = vm["dbname"].as(); - if (!vm.contains("table")) + if (!vm.count("table")) { // if schema is there, table name should be there throw runtime_error("No table name specified with schema."); @@ -783,7 +783,7 @@ void WECmdArgs::parseCmdLineArgs(int argc, char** argv) fTable = vm["table"].as(); // 2nd pos parm - if (vm.contains("load-file")) // see if input file name is given + if (vm.count("load-file")) // see if input file name is given { // 3rd pos parm fLocFile = vm["load-file"].as(); @@ -865,7 +865,7 @@ void WECmdArgs::parseCmdLineArgs(int argc, char** argv) // 1. no positional parameters - Mode 0 & stdin // 2. Two positional parameters (schema and table names) - Mode 1/2, stdin // 3. Three positional parameters (schema, table, and import file name) - else if (vm.contains("dbname")) // see if db schema name is given + else if (vm.count("dbname")) // see if db schema name is given { if (fArgMode == 0) { @@ -882,7 +882,7 @@ void WECmdArgs::parseCmdLineArgs(int argc, char** argv) fLocFile = vm["dbname"].as(); } - if (vm.contains("table")) // dest filename provided + if (vm.count("table")) // dest filename provided { fPmFile = vm["table"].as(); @@ -936,11 +936,11 @@ void WECmdArgs::parseCmdLineArgs(int argc, char** argv) else fSchema = vm["dbname"].as(); // 1st pos parm - if (vm.contains("table")) // see if table name is given + if (vm.count("table")) // see if table name is given { fTable = vm["table"].as(); // 2nd pos parm - if (vm.contains("load-file")) // see if input file name is given + if (vm.count("load-file")) // see if input file name is given { // 3rd pos parm fLocFile = vm["load-file"].as();