Changeset 12042 for trunk/FACT++/src/Configuration.cc
- Timestamp:
- 09/08/11 21:49:58 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/Configuration.cc
r11769 r12042 391 391 #ifdef HAS_SQL 392 392 po::basic_parsed_options<char> 393 Configuration::parse_database(const string & database, const po::options_description& desc, bool allow_unregistered)393 Configuration::parse_database(const string &prgname, const string &database, const po::options_description& desc, bool allow_unregistered) 394 394 { 395 395 //static const boost::regex expr("(([[:word:].-]+)(:(.+))?@)?([[:word:].-]+)(:([[:digit:]]+))?(/([[:word:].-]+))?"); … … 422 422 if (!db.empty()) 423 423 cout << "/" << db; 424 cout << "' "<< endl;424 cout << "' for " << prgname << endl; 425 425 426 426 mysqlpp::Connection conn(db.c_str(), server.c_str(), user.c_str(), passwd.c_str(), port); … … 433 433 434 434 const mysqlpp::StoreQueryResult res = 435 conn.query("SELECT fProgram, CONCAT(fKey1,fKey2), fValue " 436 "FROM ProgramOption WHERE fCounter=" 437 "(SELECT MAX(fCounter) FROM History)").store(); 435 conn.query("SELECT CONCAT(fKey1,fKey2), fValue " 436 "FROM ProgramOption " 437 "WHERE fCounter=(SELECT MAX(fCounter) FROM History) " 438 "AND (fProgram='"+prgname+"' OR fProgram='*')").store(); 438 439 /* throws exceptions 439 440 if (!res) … … 477 478 n.value.clear(); // Fixme: composing? 478 479 n.value.push_back((*v)[1].c_str()); 479 n.unregistered = unregistered;480 //n.unregistered = unregistered; 480 481 481 482 // If any parsing will be done in the future... … … 487 488 } 488 489 489 cout << endl;490 491 490 return result; 492 491 } 493 492 #else 494 493 po::basic_parsed_options<char> 495 Configuration::parse_database(const string &, const po::options_description &desc, bool)494 Configuration::parse_database(const string &, const string &, const po::options_description &desc, bool) 496 495 { 497 496 return po::parsed_options(&desc); … … 1146 1145 { 1147 1146 fDatabase = getdatabase["database"].as<string>(); 1148 cerr << "Requesting options from '" << fDatabase << "'." << endl;1147 cerr << "Requesting options from database for '" << fName << "'" << endl; 1149 1148 } 1150 1149 … … 1153 1152 const po::parsed_options parsed_database = 1154 1153 fDatabase.empty() ? po::parsed_options(&opt_database) : 1155 parse_database( fDatabase, opt_database, !checkdb);1154 parse_database(path.filename(), fDatabase, opt_database, !checkdb); 1156 1155 1157 1156 // ------------------------ (11) -------------------------
Note:
See TracChangeset
for help on using the changeset viewer.