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

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: i guess i can't code in C...
Дата
Msg-id 3EA05BFB.3090304@joeconway.com
обсуждение исходный текст
Ответ на i guess i can't code in C...  ("Jay G. Scott" <gl@arlut.utexas.edu>)
Список 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 по дате отправления:

Предыдущее
От: phil campaigne
Дата:
Сообщение: String index out of range
Следующее
От: Ennio-Sr
Дата:
Сообщение: How to insert soft CRs in db records