dbTalk Databases Forums  

Affected rows and getUpdateCount

mailing.database.mysql-java mailing.database.mysql-java


Discuss Affected rows and getUpdateCount in the mailing.database.mysql-java forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
André Nęss
 
Posts: n/a

Default Affected rows and getUpdateCount - 10-14-2005 , 03:09 AM






Looking at the changelog for the MySQL Connector/J I find an entry
from 2003 saying that getUpdateCount now returns the number of matched
rows rather than the number of affected rows. Unfortunately, I need
the latter.

In the bugs database I found that a function has been added to MySQL
5.0 which allows you to extract the number of affected rows from the
previous query, but as I run 4.1 that is not an option.

After some searching I found this post:
http://lists.mysql.com/java/6027 which initially gave me some hope,
because I run Connector/J 3.1. But alas, I have not been able to
locate any such parameter. Am I overlooking something, or has this
parameter not been added? Or is there some other way of extracting the
number of affected rows after executing an update?

And just to make sure there's no misunderstandings: by affected rows I
mean the value that you get in the "Changed" field when you execute an
update in the client.

Andr=E9 N=E6ss

--
MySQL Java Mailing List
For list archives: http://lists.mysql.com/java
To unsubscribe: http://lists.mysql.com/java?unsub=3D...ie.nctu.edu.tw


Reply With Quote
  #2  
Old   
Mark Matthews
 
Posts: n/a

Default Re: Affected rows and getUpdateCount - 10-14-2005 , 08:41 AM






-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

André Nęss wrote:
Quote:
Looking at the changelog for the MySQL Connector/J I find an entry
from 2003 saying that getUpdateCount now returns the number of matched
rows rather than the number of affected rows. Unfortunately, I need
the latter.

In the bugs database I found that a function has been added to MySQL
5.0 which allows you to extract the number of affected rows from the
previous query, but as I run 4.1 that is not an option.

After some searching I found this post:
http://lists.mysql.com/java/6027 which initially gave me some hope,
because I run Connector/J 3.1. But alas, I have not been able to
locate any such parameter. Am I overlooking something, or has this
parameter not been added? Or is there some other way of extracting the
number of affected rows after executing an update?

And just to make sure there's no misunderstandings: by affected rows I
mean the value that you get in the "Changed" field when you execute an
update in the client.

André Nęss

Andre,

The issue is that the JDBC specification requires _matched_, not changed
to be returned from Statement.executeUpdate().

I've yet to add the parameter (sorry), so until then you can either
upgrade to 5.0, or run the query as a SELECT with the same WHERE clause
to determine what row count would be returned.

-Mark
- --
Mark Matthews
MySQL AB, Software Development Manager - Connectivity
www.mysql.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDT7U+tvXNTca6JD8RAvnXAJ9yeHaFgIEeqF++tnfKQq d5288s1QCgrsfw
6P1b7rPFA5SdYgvBumrmQ9I=
=iOq+
-----END PGP SIGNATURE-----

--
MySQL Java Mailing List
For list archives: http://lists.mysql.com/java
To unsubscribe: http://lists.mysql.com/java?unsub=my...ie.nctu.edu.tw



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.