Value returned from RowsAffected

Value returned from RowsAffected

Postby Ivo » Fri 17 Dec 2004 04:12

When I make an updating in a table where doesn't affect any line, using MyQuery, the RowsAffected returned is 1.

Example:

insert into products ( product_id, product_price) values (1, 0)

the value of Product_price in update is same the value in the insert

update products set product_price = 0 where Product_id = 1

RowsAffected returned is 1
Ivo
 
Posts: 6
Joined: Fri 17 Dec 2004 03:38
Location: Brazil

Re: Value returned from RowsAffected

Postby Ikar » Fri 17 Dec 2004 13:39

RowsAffected returns a number of records responding WHERE clause. RowsAffected doesn't consider that actually update can be not performed as new data coincide with old data.
Ikar
 
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Postby Ivo » Fri 17 Dec 2004 17:18

Have MyDAC another property consider that update actually updated data due to the fact that this is sdandard behavior for MySQL and much important for my application
if you execute the update above in MySql command-line tool, for example, the return will always be "0 rows affected"
Ivo
 
Posts: 6
Joined: Fri 17 Dec 2004 03:38
Location: Brazil

Postby Ikar » Mon 20 Dec 2004 15:46

Not, MyDAC doesn't provide this functionality.
Ikar
 
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Postby Ivo » Tue 21 Dec 2004 21:47

We found in function mysql_rel_connect() in MySQL API Documentation the parameter client_flag that is a combination of flags, for example, CLIENT_COMPRESS and CLIENT_FOUND_ROWS.
CLIENT_FOUND_ROWS when set, return the number of found(matched) rows, not the number of affected rows.
CLIENT_FOUND_ROWS is usually 0, but it is set in MyDAC.
In TMyConnectionOptions exist a property Compress that probably change flag CLIENT_COMPRESS
Would it be possible you add a property in TMyConnectionOptions that change flag CLIENT_FOUND_ROWS ????? :?:

Thanks
Ivo
 
Posts: 6
Joined: Fri 17 Dec 2004 03:38
Location: Brazil

Postby Ikar » Wed 22 Dec 2004 15:39

As a rule we don't change public interface without persuasive reasons. Please specify to solve what tasks you need this behaviour.
Ikar
 
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Postby Ivo » Thu 23 Dec 2004 20:52

Have cases that I want to know the number of found(matched) rows responding WHERE clause, regardless what it was actually updated.
In these cases the flag CLIENT_FOUND_ROWS must be set. This is standard behavior for MyDac.

Have cases that I want to Know the number of affected rows to make a log of data actually changed.
In these cases the flag CLIENT_FOUND_ROWS must be not set. This is standard behavior for MySQL Server.
I believe that these cases are more important than cases above
Ivo
 
Posts: 6
Joined: Fri 17 Dec 2004 03:38
Location: Brazil

Postby Ikar » Fri 24 Dec 2004 11:45

At first MyDAC builds we uses the standard behaviour of MySQL. But by numerous requests of our users we changed it at the current one.

That functionality you specified isn't requested by overwhelming majority of the users and we don't plan to support it at the nearest time.
Ikar
 
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Postby Ivo » Fri 24 Dec 2004 12:22

Ok.
I have the source code of MyDAC and already changed this behavior.

Thanks
Ivo
 
Posts: 6
Joined: Fri 17 Dec 2004 03:38
Location: Brazil


Return to MySQL Data Access Components