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!“
franta-hg@230
     1
/**
franta-hg@230
     2
 * SQL-DK
franta-hg@230
     3
 * Copyright © 2018 František Kučera (frantovo.cz)
franta-hg@230
     4
 *
franta-hg@230
     5
 * This program is free software: you can redistribute it and/or modify
franta-hg@230
     6
 * it under the terms of the GNU General Public License as published by
franta-hg@230
     7
 * the Free Software Foundation, either version 3 of the License, or
franta-hg@230
     8
 * (at your option) any later version.
franta-hg@230
     9
 *
franta-hg@230
    10
 * This program is distributed in the hope that it will be useful,
franta-hg@230
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
franta-hg@230
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
franta-hg@230
    13
 * GNU General Public License for more details.
franta-hg@230
    14
 *
franta-hg@230
    15
 * You should have received a copy of the GNU General Public License
franta-hg@230
    16
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
franta-hg@230
    17
 */
franta-hg@230
    18
franta-hg@230
    19
#include <cstdlib>
franta-hg@230
    20
#include <iostream>
franta-hg@230
    21
franta-hg@230
    22
using namespace std;
franta-hg@230
    23
franta-hg@230
    24
int main(int argc, char* argv[]) {
franta-hg@230
    25
franta-hg@230
    26
	for (int i = 0; i < argc; i++) {
franta-hg@232
    27
		auto arg = string(argv[i]);
franta-hg@232
    28
		wcout << arg.c_str() << endl;
franta-hg@232
    29
		if (arg == "--batch") {
franta-hg@232
    30
			wcout << "BATCH !!!" << endl;
franta-hg@232
    31
		}
franta-hg@230
    32
	}
franta-hg@230
    33
franta-hg@230
    34
franta-hg@230
    35
	return 0;
franta-hg@230
    36
}
franta-hg@230
    37