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 22:15:05 |
Message-ID: | 20050210221505.GA73565@winnie.fuhr.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
On Thu, Feb 10, 2005 at 02:51:46PM -0200, Francisco Figueiredo Jr. wrote:
> Michael Fuhr wrote:
> >Does Npgsql use its own implemention of the PostgreSQL protocol?
> >If so, then that implementation will have to provide the desired
> >functionality itself.
>
> Yeap. Npgsql implements protocol itself. This is exactly the problem.
> I'm not receiving the CompletedResponse protocol message when executing
> the insert inside a function. It is through the CompletedResponse
> postgresql server says how many rows were affected. But it seems that
> when calling a function it doesn't return any.
I haven't used Npgsql, but the documentation has an example with
the following code:
NpgsqlCommand command = new NpgsqlCommand("insert into table1 values(1, 1)", conn);
Int32 rowsaffected;
try
{
rowsaffected = command.ExecuteNonQuery();
}
Is that what you're trying to do? Does it not work?
I downloaded the latest Npgsql source and found the following in
ExecuteNonQuery():
// The number of rows affected is in the third token for insert queries
// and in the second token for update and delete queries.
// In other words, it is the last token in the 0-based array.
return Int32.Parse(ret_string_tokens[ret_string_tokens.Length - 1]);
It looks like ExecuteNonQuery() is at least attempting to return
the number of rows affected.
Have I misunderstood what you're doing?
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
From | Date | Subject | |
---|---|---|---|
Next Message | Seamus Thomas Carroll | 2005-02-10 23:17:11 | Re: Help with adding C-Language Functions |
Previous Message | Tom Lane | 2005-02-10 20:43:39 | Re: Help with adding C-Language Functions |