Re: Function return number of affected rows

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: "Francisco Figueiredo Jr(dot)" <fxjrlists(at)yahoo(dot)com(dot)br>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: Function return number of affected rows
Date: 2005-02-10 14:46:54
Message-ID: 20050210144654.GB68483@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

On Thu, Feb 10, 2005 at 09:34:04AM -0200, Francisco Figueiredo Jr. wrote:
>
> I'd like to know if it is possible to get the number of affected rows of
> an insert, update or delete command inside a function.

Yes, but how you get that information depends on your client interface.
With libpq, for example, you could call PQcmdTuples(). If you're using
something else then see the relevant documentation.

> I'd like to know that, because I want to add this support, if possible,
> to Npgsql.
>
> I know the server sends a CompletedResponse message indicating the
> number of rows affected by a insert update and delete sent directly. But
> if this is inside a function? Is it possible to get this message too?

Does Npgsql use its own implemention of the PostgreSQL protocol?
If so, then that implementation will have to provide the desired
functionality itself.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Michael Fuhr 2005-02-10 14:58:00 Re: Help with adding C-Language Functions
Previous Message Michael Fuhr 2005-02-10 14:38:29 Re: Connecting without specifying a database