File: unlimited_update.rb

package info (click to toggle)
ruby-sequel 5.63.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,408 kB
  • sloc: ruby: 113,747; makefile: 3
file content (27 lines) | stat: -rw-r--r-- 687 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen-string-literal: true

module Sequel
  module Plugins
    # The unlimited_update plugin is designed to work around a
    # MySQL warning in replicated environments, which occurs if
    # you issue an UPDATE with a LIMIT clause.
    #
    # Usage:
    #
    #   # Make all model subclass not use a limit for update
    #   Sequel::Model.plugin :unlimited_update
    #
    #   # Make the Album class not use a limit for update
    #   Album.plugin :unlimited_update
    module UnlimitedUpdate
      module InstanceMethods
        private

        # Use an unlimited dataset for updates.
        def _update_dataset
          super.unlimited
        end
      end
    end
  end
end