Menu

#270 MySQL + TZUpdateSQL: 0 records were updated only one record should have been updated.

7.2.4
closed
None
2019-02-12
2018-07-18
No

Crosspost from the Zeos forums. Link and better text will be provided later, since the forums are offline currently.

The bottom line is: If one uses a TZUpdateSQL component, edits a line in a dataset but doesn't change values - or changes them back to their original values before it is posted - ant then posts the modified record, an exception with the message "0 record(s) updated. Only one record should have been updated.".

Discussion

  • EgonHugeist

    EgonHugeist - 2018-07-18

    IMHO, the behavior is expected.
    Turn off the check: "ValidateUpdateCount=false", see DSProps_ValidateUpdateCount (ZDbcProperties)
    Or use the Zeos.inc define WITH_VALIDATE_UPDATE_COUNT.

    What exactly is the bug? Nothing changes -> no update or what?

     
  • marsupilami79

    marsupilami79 - 2018-07-18

    Added two test cases to ZTestCompCoreBugReport: TestSF270_1 and TestSF270_2: TestSF270_1 tests this without a TZUpdateSQL component assigned. TestSF270_2 tests this with a TZUpdateSQL component assigned. I chose ZTestCompCoreBugReport so we can see wether this happens on other databases too.

     
  • marsupilami79

    marsupilami79 - 2018-07-18

    Sooo - we found the reason for this behaviour: MySQL returns the number of changed rows by default. If the data of a row doesn't change, 0 is returned. See https://dev.mysql.com/doc/refman/8.0/en/mysql-affected-rows.html .

    This behaviour can be changed by adding "CLIENT_FOUND_ROWS=1" to the TZConnection.Properties property.

    I suggest to enable this option for Zeos 7.3 by default, so the TZUpdateSQL component works correctly by default. This change in behaviour would need to be documented accordingly then.

     

    Last edit: marsupilami79 2018-07-20
  • EgonHugeist

    EgonHugeist - 2019-02-12
    • status: open --> closed
    • assigned_to: EgonHugeist
     
  • EgonHugeist

    EgonHugeist - 2019-02-12

    Added New/Old-Row comparsion as made in the genericresolver in R5417.
    Tests do not show any side effects. If nothing is todo, nothing is send to the server, which is nice for all providers...
    Closed, reopen if not OK.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.