X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4A2AC8BA091 for ; Thu, 10 Feb 2005 22:15:36 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 05335-01 for ; Thu, 10 Feb 2005 22:15:09 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id A693C8BA054 for ; Thu, 10 Feb 2005 22:15:09 +0000 (GMT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.1/8.13.1) with ESMTP id j1AMF7xW021464 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 10 Feb 2005 15:15:09 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.1/8.13.1) with ESMTP id j1AMF6lc086087; Thu, 10 Feb 2005 15:15:06 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.1/8.13.1/Submit) id j1AMF63F086086; Thu, 10 Feb 2005 15:15:06 -0700 (MST) (envelope-from mfuhr) Date: Thu, 10 Feb 2005 15:15:05 -0700 From: Michael Fuhr To: "Francisco Figueiredo Jr." Cc: pgsql-interfaces@postgresql.org Subject: Re: Function return number of affected rows Message-ID: <20050210221505.GA73565@winnie.fuhr.org> References: <420B46AC.9080002@yahoo.com.br> <20050210144654.GB68483@winnie.fuhr.org> <420B9122.2090802@yahoo.com.br> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <420B9122.2090802@yahoo.com.br> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/41 X-Sequence-Number: 5286 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/