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

Add new DB api for returning limit / rownum chunk of sql

XMLWordPrintable

      There a few places where you are crafting some sql and need to insert a limit clause in the sql. In particular this happens inside subselects. An example is where you want join with a subselect which is ordered in a particular way but you only want the first record.

      But not having this api it forces dev's to either just write non compatible sql (eg CONTRIB-4955) or to get an sql results set, and then reprocess it and do a second set of db calls for each row which can be horrible for performance.

      So I'm proposing:

      1) Make a new public method called limit_clause($limitfrom, $limitnum), it will return the syntax using LIMIT, and then override it as needed in each driver as needed.

      2) Refactor get_records_sql() and get_recordset_sql() in all drivers to call this new method

            ilyatregubov Ilya Tregubov
            brendanheywood Brendan Heywood
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

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