]> git.sesse.net Git - wloh/commitdiff
Fix the C++ database insertion.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 23 Oct 2012 14:15:23 +0000 (16:15 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 23 Oct 2012 14:15:23 +0000 (16:15 +0200)
bayeswf.cpp

index 205aaaba5c248391c99fdd709afb1b7ac092faea..c7aad7dbe349d3dc0ee3ccf07266dd5552d12f2b 100644 (file)
@@ -264,9 +264,9 @@ void compute_mu_uncertainty(const float *mu, const vector<int> &players)
 #else
        for (unsigned i = 0; i < players.size(); ++i) {
                for (unsigned j = 0; j < players.size(); ++j) {
-                       printf("covariance %s %s %f\n",
-                              players[i].c_str(),
-                              players[j].c_str(),
+                       printf("covariance %d %d %f\n",
+                              players[i],
+                              players[j],
                               ih(i, j));
                }
        }
@@ -406,7 +406,7 @@ void process_file(const char *filename)
 int main(int argc, char **argv)
 {
 #if USE_DB
-       pqxx::connection conn("dbname=wloh_dev host=127.0.0.1 user=wloh password=oto4iCh5");
+       pqxx::connection conn("dbname=wloh host=127.0.0.1 user=wloh password=oto4iCh5");
 #endif
        
        for (int i = 1; i < argc; ++i) {
@@ -484,7 +484,9 @@ int main(int argc, char **argv)
 #else
        //fprintf(stderr, "Optimal sigma: %f (two-player: %f)\n", sigma[0], sigma[0] * sqrt(2.0f));
        for (map<pair<string, string>, float>::const_iterator it = aux_params.begin(); it != aux_params.end(); ++it) {
-               printf("%s: aux_param %s %f\n", it->first->first, it->first->second, it->second);
+               printf("%s: aux_param %s %f\n", it->first.first.c_str(), it->first.second.c_str(), it->second);
        }
 #endif
+
+       txn.commit();
 }