bool CConnection::connect(const TParsedCommandLine &dbInfo) { const TParsedCommandLine *dbHost= dbInfo.getParam("host"); const TParsedCommandLine *dbport= dbInfo.getParam("port"); const TParsedCommandLine *dbUser= dbInfo.getParam("user"); const TParsedCommandLine *dbPassword= dbInfo.getParam("password"); const TParsedCommandLine *dbBase= dbInfo.getParam("base"); if (dbHost == NULL || dbUser == NULL || dbPassword == NULL || dbBase == NULL) { nlwarning("LS : Invalid database configuration"); if (MSWStrictMode) { nlstopex(("SQL Strict mode, the above error is fatal")); } return false; } // connect to the database return connect(dbHost->ParamValue, dbUser->ParamValue, dbPassword->ParamValue, dbBase->ParamValue); }
NLMISC_COMMAND_HANDLER_TABLE_END bool initModule(const TParsedCommandLine &initInfo) { // setup a variable to build the init message in... NLMISC::CSString logMsg; // initialise the module base classes... logMsg+= CAdministeredModuleBase::init(initInfo); // deal with the obligatory 'path' argument const TParsedCommandLine *rootArg = initInfo.getParam("path"); DROP_IF(rootArg==NULL,"path() parameter not found in command line",return false); _RootPath = NLMISC::CPath::standardizePath(rootArg->ParamValue); // we're all done so let the world know registerProgress(string("LogReportModule Initialised: ")+logMsg); setStateVariable("State","Initialised"); broadcastStateInfo(); return true; }