Skip to content

Insert multiple rows in prepared statement

Alex requested to merge 757-new-prepared-statements into master

Part of #757 (closed)

What does this MR do?

Up to now, INSERT via prepared statements only allows single rows as key-value pairs. This adds insertMultiple to the Database class that inserts multiple rows at once and makes it possible to use prepared statements more often.

I also replaced some of the db->execute queries in gateway classes that insert multiple rows:

  • when changing the managers of a food share point
  • when changing the members of a mailbox
  • when sending a newsletter which might be used for testing the insert function.

How confident are you it won't break things if deployed?

Works locally. I'm quite sure that it should work. But since I forwarded the insert function to the new function, this affects almost every instance where data is inserted, so this needs more testing.

How to test

Test one of the three points above, e.g.

  1. Checkout branch locally
  2. Login as the manager of a food share point
  3. Go to the food share points page -> 'Fair-Teiler bearbeiten' -> change the responsible persons ('Verantwortliche Foodsaver') and save

... or test anything that inserts data.

Checklist

  • added a test, or explain why one is not needed/possible... covered by existing tests
  • no unrelated changes
  • asked someone for a code review
  • joined #foodsharing-beta channel at https://slackin.yunity.org
  • added an entry to CHANGELOG.md (description, merge request link, username(s))
  • Once your MR has been merged, you are responsible to update the #foodsharing-beta Slack channel about what has been changed here. They will test your work in different browsers, roles or other settings
Edited by Alex

Merge request reports