fprintf(stderr, "Execution of prepared statement failed: %s\n", PQerrorMessage(db->conn));
exit(1);
}
+ } else if ( PQntuples(res) == 1 ) {
+ db->db.nres += atoi( PQgetvalue(res,0,0) );
+ } else {
+ fprintf(stderr,"Bad PQntuples %d\n", PQntuples(res));
+ exit(1);
}
+
PQclear(res);
db->emptyquery = 0;
sprintf(buf,"CREATE INDEX ftsindex ON ftsbench USING %s ( fts );",
(db->flags & FLG_GIST) ? "GiST" : "GIN" );
- printf("(create index, ");
- fflush(stdout);
+ report("(create index, ");
res = PQexec(db->conn, buf);
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
exit(1);
}
PQclear(res);
- } else {
- printf("(");
- fflush(stdout);
- }
+ } else
+ report("(");
- printf("vacuum");
- fflush(stdout);
+ report("vacuum");
res = PQexec(db->conn, "VACUUM ANALYZE ftsbench;");
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
exit(1);
}
PQclear(res);
- printf(") ");
- fflush(stdout);
+
+ report(") ");
return;
}