From: Francisco Figueiredo Jr. <fxjrlists@yahoo.com.br>
To: Michael Fuhr <mike@fuhr.org>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: Function return number of affected rows
Date: Sat, 12 Feb 2005 16:42:24 -0200
Message-ID: <420E4E10.6090104@yahoo.com.br> (raw)
In-Reply-To: <20050210221505.GA73565@winnie.fuhr.org>
References: <420B46AC.9080002@yahoo.com.br>
<20050210144654.GB68483@winnie.fuhr.org>
<420B9122.2090802@yahoo.com.br>
<20050210221505.GA73565@winnie.fuhr.org>
-----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-----
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: fxjrlists@yahoo.com.br, mike@fuhr.org
Subject: Re: Function return number of affected rows
In-Reply-To: <420E4E10.6090104@yahoo.com.br>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox