Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-29589

New $DB method for bulk deleting/updating records using a subselect

    XMLWordPrintable

Details

    • MOODLE_21_STABLE, MOODLE_27_STABLE
    • Hide

      1. Run the database unit tests on all our supported databases.
      2. Run Eloy's test script (from MDL-29520) that tests this sort of delete

      Show
      1. Run the database unit tests on all our supported databases. 2. Run Eloy's test script (from MDL-29520 ) that tests this sort of delete

    Description

      Supposed you want to write a query like

      DELETE FROM table WHERE id IN (SELECT ... )
      -- or
      UPDATE table SET field = value WHERE id IN (SELECT ... )
      

      while that is simple to understand, it turns out that database handle that sort of query very badly. (See, for example, MDL-29520 and MDL-32616.)

      The bad news is that there is no standard SQL syntax that works will in all our supported databases, therefore we need a new $DB-> method called delete_records_subselect or delete_records_join_select or something like that, to replace all the one-off hacks we have had to do in those places.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              timhunt Tim Hunt
              Votes:
              5 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:

                Clockify

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.