Jay G. Scott wrote:
> sprintf(buffer,
> "INSERT INTO machines (hostname, os) VALUES ('%s', '%s')",
> node, sys);
> fprintf(stderr,"===try to add:\n%s\n===\n",buffer);
>
> igot = PQsendQuery(conn_to_db,buffer);
> fprintf(stderr,"igot is %d\n",igot);
[...snip...]
> SELECT m_id FROM machines WHERE hostname = 'aaaaaaaaaaaaaaaaa2';
> ===try to add:
> INSERT INTO machines (hostname, os) VALUES ('aaaaaaaaaaaaaaaaa2', 'Solaris')
> ===
> igot is 0
I've not used the async libpq functions before, but take a look at:
http://www.us.postgresql.org/users-lounge/docs/7.3/postgres/libpq-async.html
Among other things it says:
"PQsendQuery Submit a command to the server without waiting for the
result(s). 1 is returned if the command was successfully dispatched,
0 if not (in which case, use PQerrorMessage to get more information
about the failure)."
I'd take that advice and see what the error message says.
HTH,
Joe