Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » Bugfix: MySqlConnection::GetRowsProcessed() returns correct value after an sql update
Bugfix: MySqlConnection::GetRowsProcessed() returns correct value after an sql update [message #43214] Sun, 08 June 2014 18:58 Go to next message
zsolt is currently offline  zsolt
Messages: 693
Registered: December 2005
Location: Budapest, Hungary
Contributor
The patch:
---------------------------- uppsrc/MySql/MySql.cpp ----------------------------
index 45bfc43..ee8d848 100644
@@ -361,16 +361,18 @@ bool MySqlConnection::Execute() {
 		lastid = (int)mysql_insert_id(mysql);
 		if(lastid) {
 			SqlColumnInfo& f = info.Add();
 			f.width = f.scale = f.precision = 0;
 			f.binary = false;
 			f.type = DOUBLE_V;
 			f.name = "LAST_INSERT_ID";
 			rows = 1;
+		}else{
+			rows = (int)mysql_affected_rows(mysql);
 		}
 	}
 	return true;
 }
 
 int  MySqlConnection::GetRowsProcessed() const {
 	return rows;
 }
Re: Bugfix: MySqlConnection::GetRowsProcessed() returns correct value after an sql update [message #43234 is a reply to message #43214] Wed, 11 June 2014 08:41 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
While I have accepted this patch, I am scratching my head a little:

IMO, 'rows' should have stayed set at value set at line 315, setting it again in 'else' should not change a thing?! What am I missing here?

Mirek
Re: Bugfix: MySqlConnection::GetRowsProcessed() returns correct value after an sql update [message #43236 is a reply to message #43234] Wed, 11 June 2014 13:43 Go to previous message
zsolt is currently offline  zsolt
Messages: 693
Registered: December 2005
Location: Budapest, Hungary
Contributor
Oops, this patch is not needed...
I created this patch a long time ago, but forgot to send it to you. Now I can see, that you fixed this on Mon Feb 27 14:06:09 2012 at line 315. Sorry for not checking that.
Previous Topic: Bugfix: MySql: Missing macros from schema
Next Topic: Sql Avg delivers String instead of double
Goto Forum:
  


Current Time: Thu Mar 28 20:07:00 CET 2024

Total time taken to generate the page: 0.01247 seconds