• Konstantin Osipov's avatar
    Backport of 2617.65.4 from 6.0-codebase. · 8441517b
    Konstantin Osipov authored
    A fix and a test case for Bug#34898 "mysql_info() reports 0 warnings
    while mysql_warning_count() reports 1"
    
    Review the patch by Chad Miller, implement review comments
    (since Chad left) and push the patch.
    
    This bug is actually not a bug. At least according to Monty.
    See Bug#841 "wrong number of warnings" reported back in July 2003
    and closed as "not a bug".
    mysql_info() was printing the number of truncated columns, not
    the number of warnings.
    But since the message of mysql_info() was "Warnings: <number of truncated
    columns>", people would expect to get the number
    of warnings in it, not the number of truncated columns.
    
    So a possible fix would be to change the message of mysql_info()
    to say Rows changed: <n>, truncated: <m>.
    
    Instead, put the number of warnings there. That is, remove the
    feature that thd->cuted_fields (the number of truncated fields)
    is exposed to the client. The number of truncated columns can be
    calculated on the client, by analyzing SHOW WARNINGS output,
    and in future we may remove thd->cuted_fields altogether.
    So let's have one less thing to worry about.
    8441517b
insert.result 21.5 KB