Обсуждение: ecpg problem
I just found this one on my TODO list: The error message for "no data" in an exec sql insert select from statement has to be 100. It seems I cannot get that kind of information from libpq other than checking for the result being 0 tuples. But is this correct? Or are there possibilities to get 0 tuples? That is I get PQcmdTuples(results) = 0 with the return code being PGRES_COMMAND_OK. Also I wonder if PGRES_COMMAND_OK could come from other statements for which setting the not found marker makes no sense. I think it does make sense for insert, delete and update. On the other hand returning NOT_FOUND on other commands doesn't do hany harm though since the whenever not found isn't checked for other commands. Michael -- Dr. Michael Meskes meskes@online-club.de, meskes@debian.org Go SF49ers! Go Rhein Fire! Use Debian GNU/Linux!
On Fri, 14 Aug 1998, Dr. Michael Meskes wrote: > I just found this one on my TODO list: > > The error message for "no data" in an exec sql insert select from statement > has to be 100. > > It seems I cannot get that kind of information from libpq other than > checking for the result being 0 tuples. But is this correct? Or are there > possibilities to get 0 tuples? That is I get PQcmdTuples(results) = 0 with > the return code being PGRES_COMMAND_OK. Shouldn't you check for PGRES_TUPLES_OK ? I always check for this if I want to know if a data select statement has succeeded. And this also still allows PQntuples() == 0 Maarten _____________________________________________________________________________ | TU Delft, The Netherlands, Faculty of Information Technology and Systems | | Department of Electrical Engineering | | Computer Architecture and Digital Technique section | | M.Boekhold@et.tudelft.nl | -----------------------------------------------------------------------------
On Sat, Aug 15, 1998 at 12:27:55PM +0200, Maarten Boekhold wrote: > > It seems I cannot get that kind of information from libpq other than > > checking for the result being 0 tuples. But is this correct? Or are there > > possibilities to get 0 tuples? That is I get PQcmdTuples(results) = 0 with > > the return code being PGRES_COMMAND_OK. > > Shouldn't you check for PGRES_TUPLES_OK ? I always check for this if I No, the insert command doesn't return any tuples anyway. But then I don't check for it either. libecpg has to work with every return value and so checks them all. It just happens that the insert commend returns PGRES_COMMAND_OK. :-) Michael -- Dr. Michael Meskes meskes@online-club.de, meskes@debian.org Go SF49ers! Go Rhein Fire! Use Debian GNU/Linux!