Can HeidiSQL report all records rather than just affected records (re: update statements)

[expired user #9473]'s profile image [expired user #9473] posted 8 years ago in General Permalink

HeidiSQL reports on the rows changed, as opposed to the rows updated.

For example, if I issue the same update statement twice, the first update shows 428k records affected, but the second update shows 0 records affected.

There are times I would like to know the full row count rather than the affected rows, i.e. 428k the second time I run the update. Is there any way HeidiSQL can show all rows updated, and not just affected rows?

<---- snip from log -------> update accounts_cstm ac join tmp_accounts_cstm_3x t on t.parent_id = ac.id_c set assigned_digital_c = t.digital_user_id, assigned_print_c = t.print_user_id, assigned_dms_c = t.dms_user_id; / Affected rows: 428,786 Found rows: 0 Warnings: 0 Duration for 1 query: 58.094 sec. / update accounts_cstm ac join tmp_accounts_cstm_3x t on t.parent_id = ac.id_c set assigned_digital_c = t.digital_user_id, assigned_print_c = t.print_user_id, assigned_dms_c = t.dms_user_id; / Affected rows: 0 Found rows: 0 Warnings: 0 Duration for 1 query: 18.250 sec. / <---- snip from log ------->

ansgar's profile image ansgar posted 8 years ago Permalink

No, unfortunately, HeidiSQL always reports the number of affected rows, not the number of matching rows.

The underlying MySQL API can, however, do what you want, if the connection is done with an activated CLIENT_FOUND_ROWS flag. See here:

For UPDATE statements, the affected-rows value by default is the number of rows actually changed. If you specify the CLIENT_FOUND_ROWS flag to mysql_real_connect() when connecting to mysqld, the affected-rows value is the number of rows “found”; that is, matched by the WHERE clause.

See here for a list of all available CLIENT_* flags. (Line 146)

That flag could be a checkbox option in HeidiSQL's session manager, in the Advanced tab, with other esoteric settings. No clue if that's reasonable for other users as well. And how should that checkbox be labelled?

Please login to leave a reply, or register at first.