Review main Merged Breaking

39807[!!!][BUGFIX] Check for existing index column in exec_SELECTgetRows()

Markus Klein CR +2 V +2 Normal +56 −26 updated 06/05/15, 08:44

Commit message

In case the specified $uidIndexField does not exist in the result,
throw an exception.

Do not call debug() again since it has already been called in
exec_SELECTquery().

Review

  • Code review CR +2
    • Frank Nägler +2
    • Andreas Kienast +1
  • Verified V +2
    • Frank Nägler +2
    • Andreas Kienast +1

Issues 1

Files 2

Review log 26

Show 1 earlier messages
  1. Markus Klein uploaded patch set 1 05/29/15, 21:18

  1. Stephan Großberndt commented on patch set 1 CR -1 05/29/15, 22:20

    result is not freed if exception is thrown
  2. Markus Klein uploaded patch set 2 05/29/15, 22:23

  3. Markus Klein commented on patch set 1 05/29/15, 22:23

    args... thanks good catch
  4. Andreas Kienast voted on patch set 2 CR +1 V +1 05/31/15, 18:15

  5. Andreas Kienast commented on patch set 2 05/31/15, 18:17

    DatabaseConnection.php:386

    I didn't test this special case: What happens if a value in the DB has stored "NULL"? The the field exists, but isset() will fail.
  6. Andreas Kienast voted on patch set 2 V 0 05/31/15, 18:24

  7. Markus Klein commented on patch set 2 05/31/15, 21:55

    DatabaseConnection.php:386 Reply

    To my knowledge mysqli with non-strict mysql connection never returns null, but only an empty string, that's why I chose isset() here. In any case we could go for array_key_exists here.
  8. Andreas Kienast commented on patch set 2 06/01/15, 06:48

    DatabaseConnection.php:386 Reply

    I tested it on a default MySQL 5.5 and got NULL. Anyway, I'll push a new patch set.
  9. Andreas Kienast uploaded patch set 3 06/01/15, 06:51

  10. Andreas Kienast commented on patch set 3 06/01/15, 06:52

    For the sake of performance I added array_key_exists and kept isset being the first condition.
  11. Markus Klein commented on patch set 3 06/01/15, 07:26

    Thanks
  12. Stephan Großberndt uploaded patch set 4 06/01/15, 07:52

  13. Stephan Großberndt commented on patch set 4 CR +1 06/01/15, 07:59

    Rather than making each call expensive (there will be lots!) check for key only on first record. Also an empty result and even NULL maybe a valid value for $uidIndexField resulting in an ''-index. No need to throw exceptions here. While at it - $this->debug() gets called from exec_SELECTquery() already - either the additional calls in exec_SELECTgetRows() and exec_SELECTgetSingleRow() have to be changed to have their names as parameters (but even then its called twice for a query) or be removed (as I did)
  14. Stephan Großberndt uploaded patch set 5 06/01/15, 08:01

  15. Stephan Großberndt commented on patch set 5 CR +1 06/01/15, 08:02

    And since I hate seeing "See exec_SELECTquery()" instead of a proper PHPDoc, lets fix that too ;)
  16. Andreas Kienast voted on patch set 5 CR +1 06/02/15, 10:01

  17. Wouter Wolters voted on patch set 5 CR +1 06/03/15, 11:43

  18. Andreas Kienast voted on patch set 5 V +1 06/05/15, 06:04

  19. Frank Nägler commented on patch set 5 CR -1 06/05/15, 08:06

    throwing an exception is a breaking change, we need a rst file and [!!!] prefix.
  20. Markus Klein commented on patch set 5 06/05/15, 08:17

    will do
  21. Markus Klein uploaded patch set 6 06/05/15, 08:23

  22. Andreas Kienast voted on patch set 6 V +1 CR +1 06/05/15, 08:26

  23. Frank Nägler voted on patch set 6 CR +1 06/05/15, 08:32

  24. Frank Nägler voted on patch set 6 V +2 CR +2 06/05/15, 08:44

  25. Frank Nägler merged patch set 6 06/05/15, 08:44