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 4C2B08B9ED8 for ; Sat, 12 Feb 2005 18:09:03 +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 93082-06 for ; Sat, 12 Feb 2005 18:08:54 +0000 (GMT) Received: from smtp205.mail.sc5.yahoo.com (smtp205.mail.sc5.yahoo.com [216.136.129.95]) by svr1.postgresql.org (Postfix) with SMTP id 50FF48B9EC7 for ; Sat, 12 Feb 2005 18:08:53 +0000 (GMT) Received: from unknown (HELO ?192.168.200.87?) (fxjrlists@200.140.6.213 with plain) by smtp205.mail.sc5.yahoo.com with SMTP; 12 Feb 2005 18:08:51 -0000 Message-ID: <420E4E10.6090104@yahoo.com.br> Date: Sat, 12 Feb 2005 16:42:24 -0200 From: "Francisco Figueiredo Jr." User-Agent: Mozilla Thunderbird 0.8 (X11/20041022) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Michael Fuhr Cc: pgsql-interfaces@postgresql.org Subject: Re: Function return number of affected rows References: <420B46AC.9080002@yahoo.com.br> <20050210144654.GB68483@winnie.fuhr.org> <420B9122.2090802@yahoo.com.br> <20050210221505.GA73565@winnie.fuhr.org> In-Reply-To: <20050210221505.GA73565@winnie.fuhr.org> X-Enigmail-Version: 0.86.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.374 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE X-Spam-Level: X-Archive-Number: 200502/47 X-Sequence-Number: 5292 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Michael Fuhr wrote: Hi Michael! | | 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? | Yeap. This works perfectly. | 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? | I think I didn't make myself clear enough :) When I send the update directly, Postgresql sends me back the CompletedResponse and I can see how many rows were affected. But if I create a function like: create function inserttest() returns void as ' insert into table1 values(1, 1)' language 'sql'; and I do a select * from inserttest(); I can't get the CompletedResponse saying one row was affected :( PS.: Michael, you can talk more protocol-specific way. I'm one of the authors of Npgsql and I do have a little bit of protocol background. I didn't talk directly about protocol and etc because I wanted to explain my problem first :) Also, I did a test with psql and I could check that it also doesn't say me how many rows were affected. Can this mean that what I want may not be possible? Thank you very much for your feedback Michael. - -- Regards, Francisco Figueiredo Jr. Membro Fundador do Projeto MonoBrasil - MonoBrasil Project Founder Member http://monobrasil.softwarelivre.org - ------------- "Science without religion is lame; religion without science is blind." ~ ~ Albert Einstein -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iQEVAwUBQg5OEP7iFmsNzeXfAQLrAAf/XBi3nKXcye0S+AA4+jlKjMvJ6Vz0AOr+ /wRbBo7qJo0Zh7kdLC+ClYTeLBmVUUwMwOjqucJ+RqbrXHKbK0bSzbeKIhtRduAG 6pK3k2GUPYPy33EbEcPF8cBeD5E07xSgUEIPbt4ncKVU8IWVIcoTRDUPhQpCY9dF 2WQ5ZbFpvk4nEgrLxQLU08WVahTnqiqs+9xpLHw88sxeIfaNTM7Eow4doV//s2I7 2lKerVIyQrQ0RECHzRGwHTX93wa9s3h+sfbFDy+ZzTT3st4KXknbqqOFTEuwSMRd 24shXMmWZ8WzWU8bKrPmKG5ZICpNhwMg3dfWSbkjRETCkXsZeUQenA== =KIXu -----END PGP SIGNATURE-----