Neil Conway <neilc@samurai.com> writes:
> 1. Have a process do INSERTs into a table in a tight loop (I've
> attached a trivial libpq app that does this)
Sorry, I was evidently a little too quick off the draw. A simple test
app is /really/ attached this time.
-Neil
#include <stdio.h>
#include <unistd.h>
#include <libpq-fe.h>
int
main(void)
{
PGconn *conn;
conn = PQconnectdb("");
if (PQstatus(conn) == CONNECTION_BAD)
return 1;
for (;;)
{
PGresult *res;
res = PQexec(conn, "INSERT INTO test_tbl VALUES (5, 5, 5);");
if (PQresultStatus(res) != PGRES_COMMAND_OK)
{
/* query failed */
printf("query failed: %s", PQresultErrorMessage(res));
fflush(stdout);
sleep(1);
}
PQclear(res);
}
PQfinish(conn);
return 0;
}