asynchronour queries and result testing
От | Matus \"fantomas\" Uhlar |
---|---|
Тема | asynchronour queries and result testing |
Дата | |
Msg-id | 20010515144821.A21249@fantomas.sk обсуждение исходный текст |
Список | pgsql-general |
Hello, I have this query in my .c program: if (PQsendQuery(srcmain, "select userid,uid,clear_passwd,www_home,date_part('epoch',dt_block),date_part('epoch',dt_cancel)from www where uid=parent_uid anddt_modify > dt_export")) { while ((srcmres = PQgetResult(srcmain)) != NULL) { well as doc says, "Each non-null result from PQgetResult should be processed using the same PGresult accessor functions previously described." do i understand it correctly? /* process each returned line */ if ((srcmstat = PQresultStatus(srcmres)) != PGRES_TUPLES_OK) fprintf(stderr, "error getting result: %s\n", PQresultErrorMessage(srcmres)); else { if ((srcmtup = PQntuples(srcmres)) == 6) { I just would like to know, if, in case of problem couldn't just return NULL and fill out error message; could I just process the result and if there's no data (or an error), NULL would be returned and PQresStatus could be called to see if any problem occured. Anyway, even if I get resule with 0 tuples, I need to check PQntuples and it returns 0. i think checking PQntuples in big loop is quite unefficient. could anybody comment this? Thanks. -- Matus "fantomas" Uhlar, sysadmin at NEXTRA, Slovakia; IRCNET admin of *.sk uhlar@fantomas.sk ; http://www.fantomas.sk/ ; http://www.nextra.sk/ WinError #99999: Out of error messages.
В списке pgsql-general по дате отправления: