c++/sql-dk/CLIStarter.cpp
author František Kučera <franta-hg@frantovo.cz>
Tue, 26 Feb 2019 18:19:49 +0100
branchv_0
changeset 236 a3ec71fa8e17
parent 232 4061e0c7f907
child 250 aae5009bd0af
permissions -rw-r--r--
Avoid reusing/rewriting the DB connection properties.
There was weird random errors while testing connection to multiple DB in parallel when one of them was meta connection to same DB connection.
Two kinds of exception: 1) missing password 2) „Passing DB password as CLI parameter is insecure!“
     1 /**
     2  * SQL-DK
     3  * Copyright © 2018 František Kučera (frantovo.cz)
     4  *
     5  * This program is free software: you can redistribute it and/or modify
     6  * it under the terms of the GNU General Public License as published by
     7  * the Free Software Foundation, either version 3 of the License, or
     8  * (at your option) any later version.
     9  *
    10  * This program is distributed in the hope that it will be useful,
    11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    13  * GNU General Public License for more details.
    14  *
    15  * You should have received a copy of the GNU General Public License
    16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
    17  */
    18 
    19 #include <cstdlib>
    20 #include <iostream>
    21 
    22 using namespace std;
    23 
    24 int main(int argc, char* argv[]) {
    25 
    26 	for (int i = 0; i < argc; i++) {
    27 		auto arg = string(argv[i]);
    28 		wcout << arg.c_str() << endl;
    29 		if (arg == "--batch") {
    30 			wcout << "BATCH !!!" << endl;
    31 		}
    32 	}
    33 
    34 
    35 	return 0;
    36 }
    37