Re: i guess i can't code in C...

From: Joe Conway <mail(at)joeconway(dot)com>
To: "Jay G(dot) Scott" <gl(at)arlut(dot)utexas(dot)edu>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: i guess i can't code in C...
Date: 2003-04-18 20:11:39
Message-ID: 3EA05BFB.3090304@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Ennio-Sr 2003-04-20 00:35:49 How to insert soft CRs in db records
Previous Message Jay G. Scott 2003-04-18 17:06:20 i guess i can't code in C...