Index: /trunk/FACT++/src/Configuration.cc
===================================================================
--- /trunk/FACT++/src/Configuration.cc	(revision 12041)
+++ /trunk/FACT++/src/Configuration.cc	(revision 12042)
@@ -391,5 +391,5 @@
 #ifdef HAS_SQL
 po::basic_parsed_options<char>
-    Configuration::parse_database(const string &database, const po::options_description& desc, bool allow_unregistered)
+    Configuration::parse_database(const string &prgname, const string &database, const po::options_description& desc, bool allow_unregistered)
 {
     //static const boost::regex expr("(([[:word:].-]+)(:(.+))?@)?([[:word:].-]+)(:([[:digit:]]+))?(/([[:word:].-]+))?");
@@ -422,5 +422,5 @@
     if (!db.empty())
         cout << "/" << db;
-    cout << "'" << endl;
+    cout << "' for " << prgname << endl;
 
     mysqlpp::Connection conn(db.c_str(), server.c_str(), user.c_str(), passwd.c_str(), port);
@@ -433,7 +433,8 @@
 
     const mysqlpp::StoreQueryResult res =
-        conn.query("SELECT fProgram, CONCAT(fKey1,fKey2), fValue "
-                   "FROM ProgramOption WHERE fCounter="
-                   "(SELECT MAX(fCounter) FROM History)").store();
+        conn.query("SELECT CONCAT(fKey1,fKey2), fValue "
+                   "FROM ProgramOption "
+                   "WHERE fCounter=(SELECT MAX(fCounter) FROM History) "
+                   "AND (fProgram='"+prgname+"' OR fProgram='*')").store();
     /* throws exceptions
     if (!res)
@@ -477,5 +478,5 @@
         n.value.clear();          // Fixme: composing?
         n.value.push_back((*v)[1].c_str());
-        n.unregistered = unregistered;
+        //n.unregistered = unregistered;
 
         // If any parsing will be done in the future...
@@ -487,11 +488,9 @@
     }
 
-    cout << endl;
-
     return result;
 }
 #else
 po::basic_parsed_options<char>
-    Configuration::parse_database(const string &, const po::options_description &desc, bool)
+    Configuration::parse_database(const string &, const string &, const po::options_description &desc, bool)
 {
     return po::parsed_options(&desc);
@@ -1146,5 +1145,5 @@
     {
         fDatabase = getdatabase["database"].as<string>();
-        cerr << "Requesting options from '" << fDatabase << "'." << endl;
+        cerr << "Requesting options from database for '" << fName << "'" << endl;
     }
 
@@ -1153,5 +1152,5 @@
     const po::parsed_options parsed_database =
         fDatabase.empty() ? po::parsed_options(&opt_database) :
-        parse_database(fDatabase, opt_database, !checkdb);
+        parse_database(path.filename(), fDatabase, opt_database, !checkdb);
 
     // ------------------------ (11) -------------------------
