On Sat, 2013-05-25 at 14:49 +0200, Brice André wrote:
> Hi Wolfe,
>
> First, thanks for your help.
>
> I tried your code, but it does not work... the function returns a string :
> "0". When I check, this command properly modifies one row, as expected.
>
It works for me with PQntuples.
> I don't know if it may help, but just in case... The DELETE operation is
> not performed on a table : it is performed on a view. I have a rule on that
> view that, instead of performing a delete on the corresponding table,
> performs an update with table entry tagged as deleted (in a dedicated
> column of the table). This code (sql part) works for years and, when
> executing this command by other ways (php and pgadmin), it deletes and
> returns expected data. With libpq, it deletes, but does not return anything.
>
You'll find my test case attached. It's C code, not C++, but I guess it
won't be a big issue :)
It gives me this result:
$ ./example
connection OK
prepare OK
execute OK
ntuples: 81
cleanup OK
81 is the number of lines to delete. If I launch it another time, it
gives me 0 as all the rows have already been deleted.
Hope it helps.
--
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com