Re: i guess i can't code in C... - Mailing list pgsql-novice

From Joe Conway
Subject Re: i guess i can't code in C...
Date
Msg-id 3EA05BFB.3090304@joeconway.com
Whole thread Raw
In response to i guess i can't code in C...  ("Jay G. Scott" <gl@arlut.utexas.edu>)
List pgsql-novice
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


pgsql-novice by date:

Previous
From: phil campaigne
Date:
Subject: String index out of range
Next
From: Ennio-Sr
Date:
Subject: How to insert soft CRs in db records